superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Fix has_table method (#3741)
Date Tue, 31 Oct 2017 04:04:25 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 5bc734b  Fix has_table method (#3741)
5bc734b is described below

commit 5bc734b2e5ec4e15653f68a99d831f6a991adacf
Author: mxmzdlv <maxim.zudilov@gmail.com>
AuthorDate: Tue Oct 31 17:04:23 2017 +1300

    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 f481500..aa2484f 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)

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message