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: Check for non-None database before using. (#4162)
Date Fri, 05 Jan 2018 21:54:19 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 c9e47f0  Check for non-None database before using. (#4162)
c9e47f0 is described below

commit c9e47f0bb3f908bfc0634126f1548de8c0fa0b3c
Author: Alexander Tronchin-James <alex.n.james+git@gmail.com>
AuthorDate: Fri Jan 5 13:54:17 2018 -0800

    Check for non-None database before using. (#4162)
    
    Some valid sqlalchemy uri's return a URL object with database=None, which causes the following
error:
    ```
    2018-01-05 17:59:47,560:ERROR:root:argument of type 'NoneType' is not iterable
    Traceback (most recent call last):
      File "/opt/incubator-superset/superset/sql_lab.py", line 186, in execute_sql
        user_name=user_name,
      File "/opt/incubator-superset/superset/utils.py", line 124, in __call__
        return self.func(*args, **kwargs)
      File "/opt/incubator-superset/superset/models/core.py", line 644, in get_sqla_engine
        url = self.db_engine_spec.adjust_database_uri(url, schema)
      File "/opt/incubator-superset/superset/db_engine_specs.py", line 505, in adjust_database_uri
        if '/' in database:
    TypeError: argument of type 'NoneType' is not iterable
    ```
    This patch corrects that problem.
---
 superset/db_engine_specs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 19f541d..d26f633 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -502,7 +502,7 @@ class PrestoEngineSpec(BaseEngineSpec):
     @classmethod
     def adjust_database_uri(cls, uri, selected_schema=None):
         database = uri.database
-        if selected_schema:
+        if selected_schema and database:
             if '/' in database:
                 database = database.split('/')[0] + '/' + selected_schema
             else:

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

Mime
View raw message