read_sql_table gives AttributeError when reading a database
See original GitHub issueWhen I try to read from a sql database:
df_database = create_engine('sqlite:///' + database_path)
df = dd.read_sql_table('table', df_database, 'id_driver')
I get this error: AttributeError: 'Engine' object has no attribute '_instantiate_plugins'
If I use the pandas read_sql_query
function on the same db, it works just fine.
Here’s a full trace:
AttributeError Traceback (most recent call last) ipython-input-10-2da58b7e1773 in <module>() 3 t0 = time.time() ----> 4 df = dd.read_sql_table(‘table’, df_database, ‘id_driver’) 5 t1 = time.time() 6
~/lib/python3.6/site-packages/dask/dataframe/io/sql.py in read_sql_table(table, uri, index_col, divisions, npartitions, limits, columns, bytes_per_chunk, **kwargs) 66 if index_col is None: 67 raise ValueError(“Must specify index column to partition on”) —> 68 engine = sa.create_engine(uri) 69 meta = sa.MetaData() 70 if isinstance(table, six.string_types):
~/lib/python3.6/site-packages/sqlalchemy/engine/init.py in create_engine(*args, **kwargs) 389 strategy = kwargs.pop(‘strategy’, default_strategy) 390 strategy = strategies.strategies[strategy] –> 391 return strategy.create(*args, **kwargs) 392 393
~/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py in create(self, name_or_url, **kwargs) 50 u = url.make_url(name_or_url) 51 —> 52 plugins = u._instantiate_plugins(kwargs) 53 54 u.query.pop(‘plugin’, None)
AttributeError: ‘Engine’ object has no attribute ‘_instantiate_plugins’
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (12 by maintainers)
Top GitHub Comments
The second argument to
read_sql_table
should not be an engine, but a URI from which an engine can be made.OK. I didn’t know. Thanks. I’ll try to push something soon about this “good first” issue.