Bugazelle/export-csv-to-influx

Time zone format

Closed this issue · 4 comments

Very simple question. what is the format for entering a parameter for the time_zone variable? My data is no taken in the UTC zone, but rather UTC-7

I have tried a few options, UTC-7, GMT-7, MDT (Mountain Daylight Time in US) but none are recognized. What is the proper format please?
By the way, so far, your program is working very well for me.

I found the answer--the format is that which is used in the "pytz" function. These can be found here: https://stackoverflow.com/questions/36067621/python-all-possible-timezone-abbreviations-for-given-timezone-name-and-vise-ve
In my case, it was "America/Denver"
(Note that as usual, this does not take the issue of daylight savings time into account.)

Sorry for the delay.
I am focusing on it now. And will response you ASAP.

Hello @dwkisker,

Would you please try use the "-tz" to change your timezone?

-tz, --time_zone, Timezone of supplied data. Default: UTC.

Just now, I tried your timezone "America/Denver" at my side. It is working on my side.
And thank you for clarify the "pytz" function.
Here is the logs:

1. Run exporter

export_csv_to_influx \
	--csv demo.csv \
	--dbname demo \
	--measurement denver \
	--tag_columns url \
	--field_columns response_time \
	--user admin \
	--password admin \
	--force_insert_even_csv_no_update True \
	--server 127.0.0.1:8086 \
	--time_zone "America/Denver"

2. The csv
the 1st line of demo.csv is:

2019-07-11 02:04:05,https://jmeter.apache.org/,1.434

3. the result

> use demo
Using database demo
> select * from denver limit 1
name: denver
time                response_time url
----                ------------- ---
1562832245000000000 1.434         https://jmeter.apache.org/

4. Verify result
The converted timestamp "1562832245" is matched to "America/Denver" - 2019-07-11 02:04:05.
https://www.epochconverter.com/timezones?q=1562832245&tz=America%2FDenver

Yes. This now works. The primary issue was needing the exact format for the timezone.

I have a lot to learn about python, but your work has greatly simplified this part of it...