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 michellethomas committed May 23, 2018
1 parent 86d9ac8 commit 115f4b6
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 115f4b6

Please sign in to comment.