You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/08/23 21:24:21 UTC

[superset] branch master updated: fix: small fixes for the meta DB (#25067)

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 3630d6844c fix: small fixes for the meta DB (#25067)
3630d6844c is described below

commit 3630d6844c0f4668f7196beadd744e582c9219bd
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Aug 23 14:24:13 2023 -0700

    fix: small fixes for the meta DB (#25067)
---
 superset/extensions/metadb.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/superset/extensions/metadb.py b/superset/extensions/metadb.py
index 79a3c446c4..ef2c093475 100644
--- a/superset/extensions/metadb.py
+++ b/superset/extensions/metadb.py
@@ -62,7 +62,7 @@ from shillelagh.fields import (
 )
 from shillelagh.filters import Equal, Filter, Range
 from shillelagh.typing import RequestedOrder, Row
-from sqlalchemy import MetaData, Table
+from sqlalchemy import func, MetaData, Table
 from sqlalchemy.engine.url import URL
 from sqlalchemy.exc import NoSuchTableError
 from sqlalchemy.sql import Select, select
@@ -397,6 +397,13 @@ class SupersetShillelaghAdapter(Adapter):
                 raise ProgrammingError(f"Invalid rowid specified: {row_id}")
             row[self._rowid] = row_id
 
+        if (
+            self._rowid
+            and row[self._rowid] is None
+            and self._table.c[self._rowid].autoincrement
+        ):
+            row.pop(self._rowid)
+
         query = self._table.insert().values(**row)
 
         with self.engine_context() as engine:
@@ -407,7 +414,7 @@ class SupersetShillelaghAdapter(Adapter):
             if self._rowid:
                 return result.inserted_primary_key[0]
 
-            query = self._table.count()
+            query = select([func.count()]).select_from(self._table)
             return connection.execute(query).scalar()
 
     @check_dml