When using pandas, I can connect to
import sqlalchemy as db
db.create_engine('sqlite:///C:\db\PositionTrackDB.db')
Now, I am trying to replace pandas with modin.pandas and work with databases. But no matter what I try, I always get the error of an unsupported database:
import modin.pandas as pd
from modin.db_conn import ModinDatabaseConnection
conn = ModinDatabaseConnection('sqlite:///test.db')
Error:
modin.db_conn.UnsupportedDatabaseException: Unsupported database library sqlite:///test.db
The official documentation is not very helpful for this error: https://modin.readthedocs.io/en/0.12.0/using_modin.html
Any help greatly appreciated!
EDIT:
This fixed this issue but since the connection is properly established, it complains that it cant find the table:
import modin.pandas as pd
from modin.db_conn import ModinDatabaseConnection
conn = ModinDatabaseConnection('sqlalchemy', 'sqlite:///test.db')
# Can use get_connection to get underlying sqlalchemy engine
conn.get_connection()
Error:
[SQL: SELECT COUNT(*) FROM (['TEST']) AS _] (Background on this error at: sqlalche.me/e/14/e3q8)
I run inspector.get_table_names() and it clearly tells me
['TEST']
..not sure what the proper syntax might be?
Thanks for asking this question!
Firstly, you can go ahead and try to use
pd.read_sqlas you would in pandas and things should still work as expect. Secondly, I believe you are usingModinDatabaseConnectionincorrectly (some of this is our fault for making the error messages a little vague). The constructor actually expect you to pass in the underlying SQL library to use and then takes in arguments to pass in to create that engine. Could you try something like this:This should be able to create a working conn object that you can pass into
read_sql. The original problem that you were facing was that you were passing the entire db connection as thelibargument.