Closed PiewTix closed 5 months ago
Hi @PiewTix,
Thank you for choosing our client for your project.
To ensure we're on the same page, could you share how you're currently initializing the write_api
? Based on your description, it sounds like your use case would benefit greatly from using the synchronous version of the API. This approach ensures that data writes are completed before the program proceeds, which might align well with your requirements.
Here's how you can initialize the write_api
for synchronous operations:
write_api = client.write_api(write_options=SYNCHRONOUS)
This configuration directs the write_api
to operate in a synchronous manner, providing a straightforward handling of write operations.
If you have any further questions or need additional assistance with your implementation, please don't hesitate to reach out.
Regards.
Hi @bednar ,
Thank you for your response.
Currently, this is indeed how I am initializing the write_api
.
The InfluxDBv2 database is hosted on a Linux machine right now. I am still using a Linux machine (the same where the database is runnig) to execute my code, as it doesn't work on my Windows 11 machine yet.
@PiewTix, thanks for response.
Can you also check the debug output of the client? You can initialise the client with debug output by: InfluxDBClient("http://localhost:8099", token="my-token", debug=True)
.
Hi @bednar , Thanks for you response.
Where am I supposed to get the debug output? I don't see anything in my terminal in which I run the Python script.
Also, as I've decided to keep the Influx database on a Linux host, I don't see it as an issue anymore. Thank you for your time and help anyway!
The debug output should be in console output.
Specifications
Code sample to reproduce problem
Expected behavior
I expect a record in InfluxDB with the provided timestamp from Python. With the provided code, no record gets added. Neither with the variable "time" With "current_time", a record gets added but it's the current time of the host PC when querying the record in the DB. So not the current time of adding the record through Python.
Actual behavior
Either InfluxDB takes the current time of the host PC at querying or no record gets added, depending on which timeformat is being used.
UPDATE
I tried to run the exact same code on a Linux host with an InfluxDBv2 database running on the same Linux host and it worked perfectly. So I suppose it's an issue specifically for a Windows (11) host? Is there a way I can fix it? I need it to work on a Windows 11 host as well...