-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InfluxDBClient.from_config_file()
incompatible with config files generated by influx setup
#201
Comments
Hi @bgottula, thanks for using our client. As you mentioned the configuration for the client should be formatted as a ini file. How the format looks like is described in configparser documentation - https://docs.python.org/3/library/configparser.html. The InfluxDB config file is formatted as a TOML - https://toml.io/en/. We will prepare an example how to configure client by: '~/.influxdbv2/configs'. Regards |
Thanks for the comment. I suppose an example would be helpful, but I didn't report this because I couldn't think of a work-around. Was the selection of different and subtly incompatible formats for the client and server configuration files really a deliberate design decision? Forgive me if I find that quite surprising and silly. |
We decided to select format which is common in Python community, but we are also open mined so We could support both types of format. |
Okay, fair enough. In my case supporting TOML in the Python client would be handy since I'm running the Python client and the server on the same machine, so the config file generated by
Which is good enough for me. |
Hi Jakub @bednar, let me propose another solution. You can create a default ConfigParser, which can accept extra argument. For example.
Preferably easier way is to strip the value from get() function on line 86 and write:
The solution @bgottula is possible, but ultimately does not eliminate the redundancy of code. I would like to reuse already existing configs. Thank you. |
Hi @ondrej-ivanko, thanks for suggestions...
maybe the easier way will be the best ;) |
Hello @bednar, thank you for taking care of it. Please dont forget to apply the same approach to org and token as well.
Cheers. |
The method
InfluxDBClient.from_config_file()
does not seem to be compatible with the config file format generated byinflux setup
due to quotation marks around strings. Would it be better to make the client deal with the quotation marks correctly, perhaps by.strip()
-ing the quote characters, or would it be better to change the config file format generated byinflux setup
?Steps to reproduce:
This creates the file ~/.influxdbv2/configs where the first un-commented section is as below, note the quotation marks around all the strings:
Expected behavior:
Points are written to the bucket successfully.
Actual behavior:
Multiple unsuccessful attempts to write points, emitting the following to the console:
The useful clue is this part:
Additional details:
Based on the error message, clearly the URL is missing the "http:" up front, and there are a bunch of "%22" instances scattered around, which is the URL encoding for
"
. Inspecting theInfluxDBClient
object that was created:The strings from the config file were captured with the quotation marks included (this applies to token and org as well). If I edit the config file to remove the quotation marks I'm able to write to the database with no problems.
User Franky1 replied to my post on the user forum with some insight:
Specifications:
The text was updated successfully, but these errors were encountered: