From 5bc734b2e5ec4e15653f68a99d831f6a991adacf Mon Sep 17 00:00:00 2001 From: mxmzdlv Date: Tue, 31 Oct 2017 17:04:23 +1300 Subject: [PATCH] Fix has_table method (#3741) 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(), ...). --- superset/models/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset/models/core.py b/superset/models/core.py index f481500b5..aa2484fdb 100644 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -788,8 +788,8 @@ class Database(Model, AuditMixinNullable): 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)