# Error when bulk importing line protocol files

**URL:** <https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851>\
**Category:** Telegraf\
**Tags:** influxdb\
**Created:** [June 16, 2020, 3:42pm UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851 "2020-06-16T15:42:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luca15f](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/luca15f/32/2496_2.png) [@luca15f](https://community.influxdata.com/u/luca15f)\
**Post date:** [June 16, 2020, 3:42pm UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851/1 "2020-06-16T15:42:10Z")

</div>

Hello,

it’s been a while since i used InfluxDB for the last time. Now, i am lucky enough to join a new activity that uses this wonderful technology.

I understand that something has changed, but i really do not understand why i cannot import data as i always did.

I have a big .txt file:

_# DDL_  
_CREATE DATABASE db_  
_CREATE RETENTION POLICY weekly\_data ON db DURATION 7d REPLICATION 1_

_# DML_  
_# CONTEXT−DATABASE: db_  
_# CONTEXT−RETENTION−POLICY: weekly\_data_

_recordings,sensor=s,pp=1,sub\_pr=1091,tool=3 value=0.65 330557445980703_  
_recordings,sensor=s,pp=1,sub\_pr=1091,tool=3 value=-1.8 330557446058706_  
_recordings,sensor=s,pp=1,sub\_pr=1091,tool=3 value=-1.0 330557446136709_  
…

and i am trying to import it using the command:

**influx -host 192.168.0.0 -import -path=C:\path\line\_pr.txt -precision=ns**

With my big surprise, i see this error:

**error writing batch: {“error”:“database is required”}**

Where is the error? I would say that everything is fine, or at least was 2 years ago, when i ran the same command.

Any help is appreciated.

Luca

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [June 16, 2020, 4:12pm UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851/2 "2020-06-16T16:12:12Z")

</div>

Hello @luca15f,  
What version are you running?

---

<div class="post-metadata">

**Author:** ![luca15f](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/luca15f/32/2496_2.png) [@luca15f](https://community.influxdata.com/u/luca15f)\
**Post date:** [June 16, 2020, 4:25pm UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851/3 "2020-06-16T16:25:31Z")

</div>

I am currently using last stable version, v1.8.

---

<div class="post-metadata">

**Author:** ![luca15f](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/luca15f/32/2496_2.png) [@luca15f](https://community.influxdata.com/u/luca15f)\
**Post date:** [June 18, 2020, 1:25pm UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851/4 "2020-06-18T13:25:57Z")

</div>

Any suggestions here? I still cannot solve this issue. I tried to run the same import command from the server itself, but nothing changed.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/daniel/32/142_2.png) [@daniel](https://community.influxdata.com/u/daniel)\
**Post date:** [June 18, 2020, 7:59pm UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851/5 "2020-06-18T19:59:52Z")

</div>

This seems like a bug to me, I would open a [new issue](https://github.com/influxdata/influxdb/issues/new/choose).

You could use Telegraf as a workaround, I recommend using the [nightly builds](https://github.com/influxdata/telegraf#nightly-builds) so that you have [#7210](https://github.com/influxdata/telegraf/pull/7210). You then would need to comment out all the DDL & DML lines since Telegraf doesn’t support them and setup the tail input and the influxdb output.

---

<div class="post-metadata">

**Author:** ![luca15f](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/luca15f/32/2496_2.png) [@luca15f](https://community.influxdata.com/u/luca15f)\
**Post date:** [June 19, 2020, 7:28am UTC](https://community.influxdata.com/t/error-when-bulk-importing-line-protocol-files/14851/6 "2020-06-19T07:28:03Z")

</div>

I agree, this seems a bug to me too, but, anyway, I found a workaround that I am explaining here for any user who is experiencing the same issue.

I read the same tutorial that i followed 2 years ago (you can find it here: [Getting Started: Writing Data to InfluxDB | InfluxData](https://www.influxdata.com/blog/getting-started-writing-data-to-influxdb/)). This webpage is about converting csvs in line protocol files (as I did) and sending them to an influxdb server.

As you can see, the line protocol example (that you can find here: [GettingStarted\_WritingPoints/Data at master · Anaisdg/GettingStarted\_WritingPoints · GitHub](https://github.com/Anaisdg/GettingStarted_WritingPoints/tree/master/Data) , at the import.txt file) starts with:

_DDL_  
_CREATE DATABASE import_

_# DML_  
_# CONTEXT-DATABASE: import_

that is the very same exact start string I’ve used before and that ended up in the above error (in fact, I tried the import writing no detail on retention policy in both DML and DDL, but again the error showed up).

So I tried the donk way: **I literally copied the above preamble and pasted it on top of my line protocol file, and magic happened. Import worked flawlessly.**

I don’t know the cause of the issue I’ve encountered. Maybe some special character I used for carriage return, or line feed. I really do not know. I tried to compare both versions of the preamble (the one I produced with the python script and the one I copied from Github page) with Notepad++, and they looked the same.

Hope this helps!

Luca
