questdb / py-questdb-client

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

Dataframe timestamp column forcibly renamed to 'timestamp' #43

Closed fox895 closed 1 year ago

fox895 commented 1 year ago

When importing a dataframe and specifying a timestamp column with `at=...', the column name is discarded and replaced with 'timestamp'.

df = pd.DataFrame({
    'temperature': [20.0, 21.0],
    'humidity': [0.5, 0.6],
    'time': pd.to_datetime(['2021-01-01', '2021-01-02'])})

with Sender('server', 9009) as sender:
    sender.dataframe(df, at='time')

image

I would expect that the column name is persisted in the final table.

amunra commented 1 year ago

This is a limitation of the underlying ILP protocol. Not a client bug.

Workaround: create the table in advance via SQL via the HTTP or PostgreSQL interface.