johntruckenbrodt / pyroSAR

framework for large-scale SAR satellite data processing
MIT License
511 stars 112 forks source link

Change checking if Tables should be created #167

Closed MarkusZehner closed 3 years ago

MarkusZehner commented 3 years ago

Encountered this while running formerly working scripts. Quick fix, but maybe there is more to it.

Appeared while creating a new sqlite DB, or opening an existing one:

Traceback (most recent call last):
  File "script.py", line 141, in <module>
    with Archive(dbfile) as archive:
  File "/pyroSAR/pyroSAR/drivers.py", line 1948, in __init__
    if not self.engine.dialect.has_table(self.engine, 'data'):
  File "/miniconda3/envs/process_s1/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 2009, in has_table
    self._ensure_has_table_connection(connection)
  File "/miniconda3/envs/process_s1/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 341, in _ensure_has_table_connection
    raise exc.ArgumentError(
sqlalchemy.exc.ArgumentError: The argument passed to Dialect.has_table() should be a <class 'sqlalchemy.engine.base.Connection'>, got <class 'sqlalchemy.engine.base.Engine'>. Additionally, the Dialect.has_table() method is for internal dialect use only; please use ``inspect(some_engine).has_table(<tablename>>)`` for public API use.

Running with sqlalchemy 1.4.22 py38h7f8727e_0
sqlalchemy-utils 0.37.8 pyhd3eb1b0_0
sqlite 3.36.0 hc218d9a_0

johntruckenbrodt commented 3 years ago

Hi @MarkusZehner. Thanks for addressing this. This is the reason sqlalchemy is currently limited to <1.4 in the dependencies. I'd greatly appreciate if you could adapt the code to later versions ;-).