sqlalchemy_dremio icon indicating copy to clipboard operation
sqlalchemy_dremio copied to clipboard

AttributeError: 'DremioDialect_flight' object has no attribute 'driver'

Open tiandklerk opened this issue 2 years ago • 5 comments

Hi, Thank you for creating this! I am hoping the following may be an easy fix. I think there was a change made to SQLAlchemy as it attempts to print driver and name in a warning and this causes the module to fail.

/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py in execute(self, statement, *multiparams, **params)
   1304             )
   1305         else:
-> 1306             return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
   1307 
   1308     def _execute_function(self, func, multiparams, params, execution_options):

/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/sql/elements.py in _execute_on_connection(self, connection, multiparams, params, execution_options, _force)
    330     ):
    331         if _force or self.supports_execution:
--> 332             return connection._execute_clauseelement(
    333                 self, multiparams, params, execution_options
    334             )

/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py in _execute_clauseelement(self, elem, multiparams, params, execution_options)
   1488         )
   1489 
-> 1490         compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
   1491             dialect=dialect,
   1492             compiled_cache=compiled_cache,

/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/sql/elements.py in _compile_w_cache(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)
    510         **kw
    511     ):
--> 512         if compiled_cache is not None and dialect._supports_statement_cache:
    513             elem_cache_key = self._generate_cache_key()
    514         else:

/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py in __get__(self, obj, cls)
   1111         if obj is None:
   1112             return self
-> 1113         obj.__dict__[self.__name__] = result = self.fget(obj)
   1114         return result
   1115 

/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py in _supports_statement_cache(self)
    363                 "for SQLAlchemy 1.4 caching support.   Alternatively, this "
    364                 "attribute may be set to False which will disable this "
--> 365                 "warning." % (self.name, self.driver),
    366                 code="cprf",
    367             )

AttributeError: 'DremioDialect_flight' object has no attribute 'driver'

tiandklerk avatar Feb 16 '23 12:02 tiandklerk

Looks like this is already fixed on master - would it be possible to get a bug fix release? @narendrans

andersbogsnes avatar Mar 01 '23 11:03 andersbogsnes

Awesome stuff, will wait for @narendrans to reply :)

tiandklerk avatar Mar 06 '23 12:03 tiandklerk

@tiandklerk How did you solve it?I also encountered this problem

web3creator avatar Nov 24 '23 17:11 web3creator

Still not resolved :(

tiandklerk avatar Nov 27 '23 11:11 tiandklerk

Till @narendrans gets around to fixing this, here's what you add to get around this:

from sqlalchemy_dremio.flight import DremioDialect_flight
DremioDialect_flight.supports_statement_cache = False

lenoyjacob avatar Feb 07 '24 23:02 lenoyjacob

This issue should be resolved with #34 in 3.0.4. Please let me know if everything works as expected.

chufe-dremio avatar Jun 19 '24 07:06 chufe-dremio