questdb / py-questdb-client

Python client for QuestDB InfluxDB Line Protocol
https://py-questdb-client.readthedocs.io
Apache License 2.0
55 stars 10 forks source link

docs: Fix examples, remove buggy utcnow from examples. #38

Closed amunra closed 1 year ago

amunra commented 1 year ago

Fixing examples that still used datetime.datetime.utcnow() which almost always results in buggy code.

The issue is that utcnow() creates a local timezone object with the UTC time. In other words, as soon as that object is inserted into a database, its local timezone is converted to UTC and therefore skewed by N hours, unless the box's time just happens to be set to UTC.

In other words, to get the current timestamp use any of:

Closes https://github.com/questdb/py-questdb-client/issues/37