Skip to content

Commit

Permalink
Fix has_table method (apache#3741)
Browse files Browse the repository at this point in the history
Dialect's has_table method requires connection as the first argument, not engine (https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/interfaces.py#L454). Instead, we can use engine's has_table method that handles the connection for us (https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/base.py#L2141). Alternatively, we could call engine.dialect.has_table(engine.connect(), ...).
  • Loading branch information
mxmzdlv authored and mistercrunch committed Oct 31, 2017
1 parent 814b70f commit 5bc734b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions superset/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,8 @@ def get_perm(self):

def has_table(self, table):
engine = self.get_sqla_engine()
return engine.dialect.has_table(
engine, table.table_name, table.schema or None)
return engine.has_table(
table.table_name, table.schema or None)

def get_dialect(self):
sqla_url = url.make_url(self.sqlalchemy_uri_decrypted)
Expand Down

0 comments on commit 5bc734b

Please sign in to comment.