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 8764ae3  [sqllab] fix exception caused by casting string to int with 
psycopg2 (#9287)
8764ae3 is described below

commit 8764ae385206c8bdccba1e7aa42def1929f6fba7
Author: ʈᵃᵢ <[email protected]>
AuthorDate: Mon Mar 16 10:51:41 2020 -0700

    [sqllab] fix exception caused by casting string to int with psycopg2 (#9287)
    
    * [sqllab] fix exception caused by casting string to int with psycopg2
    
    * rollback session on exception
    
    * add SQLLAB_BACKEND_PERSISTENCE to default feature flags
    
    * cast tab_state_id to str in python instead of sql
    
    * remove import
---
 superset/config.py     | 1 +
 superset/views/core.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/superset/config.py b/superset/config.py
index a44a671..8a85d14 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -285,6 +285,7 @@ DEFAULT_FEATURE_FLAGS = {
     "REDUCE_DASHBOARD_BOOTSTRAP_PAYLOAD": False,
     "SHARE_QUERIES_VIA_KV_STORE": False,
     "TAGGING_SYSTEM": False,
+    "SQLLAB_BACKEND_PERSISTENCE": False,
 }
 
 # This is merely a default.
diff --git a/superset/views/core.py b/superset/views/core.py
index 4690009..ff6dcbf 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -2704,7 +2704,7 @@ class Superset(BaseSupersetView):
             .filter_by(user_id=user_id)
             .all()
         )
-        tab_state_ids = [tab_state[0] for tab_state in tabs_state]
+        tab_state_ids = [str(tab_state[0]) for tab_state in tabs_state]
         # return first active tab, or fallback to another one if no tab is 
active
         active_tab = (
             db.session.query(TabState)
@@ -2728,7 +2728,7 @@ class Superset(BaseSupersetView):
             user_queries = (
                 db.session.query(Query)
                 .filter_by(user_id=user_id)
-                .filter(Query.sql_editor_id.cast(Integer).in_(tab_state_ids))
+                .filter(Query.sql_editor_id.in_(tab_state_ids))
                 .all()
             )
             queries = {

Reply via email to