Replies: 0 comments 6 replies
-
When looking at the CrateDB and Linear Regression Notebook, this might not even be hard to implement and just a matter of adding a small wrapper for improved convenience, so that we do not have to write this over and over again:
cc @patrickFuerst, @mechanomi |
Beta Was this translation helpful? Give feedback.
-
@amotl maybe I'm missing something, but how would a wrapper make it more convenient than just calling these two lines for reading and writing? |
Beta Was this translation helpful? Give feedback.
-
Hi again, I've investigated the situation more thoroughly with a demo program for exporting pandas data frames to SQL databases. ObservationsPostgreSQL compatibilityWhen using the PostgreSQL protocol, pandas_to_sql(dburi="postgres://crate@localhost/dwd") it obviously croaks with the venerable sqlalchemy.exc.InternalError: (psycopg2.errors.InternalError_) line 1:1: mismatched input 'ROLLBACK' expecting {'SELECT', 'DEALLOCATE', 'CREATE', 'ALTER', 'KILL', 'BEGIN', 'COMMIT', 'ANALYZE', 'DISCARD', 'EXPLAIN', 'SHOW', 'OPTIMIZE', 'REFRESH', 'RESTORE', 'DROP', 'INSERT', 'VALUES', 'DELETE', 'UPDATE', 'SET', 'RESET', 'COPY', 'GRANT', 'DENY', 'REVOKE'} Databases vs. schemasHowever, the HTTP driver variant, when trying to address a specific database - here, pandas_to_sql(dburi="crate://crate@localhost/dwd") also croaks with: File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/crate/client/sqlalchemy/dialect.py", line 198, in connect
return self.dbapi.connect(servers=server, **kwargs)
TypeError: connect() got an unexpected keyword argument 'database' EvaluationI know that CrateDB supports neither the crate=> ROLLBACK;
ERROR: line 1:1: mismatched input 'ROLLBACK' expecting {'SELECT', 'DEALLOCATE', 'CREATE', 'ALTER', 'KILL', 'BEGIN', 'COMMIT', 'ANALYZE', 'DISCARD', 'EXPLAIN', 'SHOW', 'OPTIMIZE', 'REFRESH', 'RESTORE', 'DROP', 'INSERT', 'VALUES', 'DELETE', 'UPDATE', 'SET', 'RESET', 'COPY', 'GRANT', 'DENY', 'REVOKE'} crate=> CREATE DATABASE testdrive;
ERROR: line 1:8: no viable alternative at input 'CREATE DATABASE' EpilogueWhile CrateDB fails to satisfy the With kind regards, |
Beta Was this translation helpful? Give feedback.
-
Hi @amotl, I was inspired by your ideas but struggled more than I am willing to admit (mostly unhelpful error messages). Yet, I found a way that works for me: Just UNNEST a list of records into an object column.
I wanted to share this because others might find it helpful. Have not yet found an elegant way to get rid of the object and extract them to regular columns though. Thanks for your input and warm regards, |
Beta Was this translation helpful? Give feedback.
-
Dear @inviridi, thanks a stack for sharing your code. I have to admit I did not evaluate it yet, but I am looking forward. However, after working on different improvements about efficient data import with pandas and CrateDB recently, we just uploaded a corresponding code snippet at Demonstrate efficient batched inserts using CrateDB and pandas. It may be helpful to the community. Specifically, the With kind regards, /cc @hlcianfagna, @hammerhead, @marijaselakovic Footnotes |
Beta Was this translation helpful? Give feedback.
-
Hi Andreas, thanks a lot for your hard work on CrateDB and this specific feature! Although I use CrateDB less frequently than I'd like to, I very much enjoy seeing feature improvements, your professional interactions with the community and the helpful posts by your colleagues. I'll check you the efficient batch inserts when the need arises and give feedback here. All the best and happy belated Easter, |
Beta Was this translation helpful? Give feedback.
-
Hi there,
influxdb-python
received support for reading and writing Pandas DataFrames through influxdata/influxdb-python#86 by @timtroendle the other day. The usage of itsinfluxdb.DataFrameClient
is outlined withintutorial_pandas.py
and is just a matter of invokingI believe it would be nice to also see respective support for CrateDB in order to unlock quite an amount of more scenarios this driver can be used for.
With kind regards,
Andreas.
Beta Was this translation helpful? Give feedback.
All reactions