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

BUG: When saving a pd.DataFrame with column name "timestamp" it fails #40

Closed newskooler closed 1 year ago

newskooler commented 1 year ago

I am saving a pd.DataFrame where one of the columns is named timestamp.

image image

I save it in the following way:

from questdb.ingress import Sender

with Sender('localhost', 9009) as sender:
    sender.dataframe(df, table_name='my_table')

The result in QDB is the following: image Note how the timestamp column is wrongly inputted in QDB for some reason.

newskooler commented 1 year ago

Using

with Sender('localhost', 9009) as sender:
    sender.dataframe(df, table_name='my_table', at='timestamp')

and making sure that the column is of type datetime64[ns] or datetime64[ns, tz] column. solved the problem

amunra commented 1 year ago

I'm glad you figured it out :-)