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 19:59:53 UTC

[superset] branch fix-count-meta-db created (now e079bfa902)

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

beto pushed a change to branch fix-count-meta-db
in repository https://gitbox.apache.org/repos/asf/superset.git


      at e079bfa902 Fix autoincrement

This branch includes the following new commits:

     new 2686bfd2f8 fix: count in meta DB
     new e079bfa902 Fix autoincrement

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/02: fix: count in meta DB

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch fix-count-meta-db
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 2686bfd2f88aedaa9571f5eada5af39917c3f36b
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Aug 23 10:47:13 2023 -0700

    fix: count in meta DB
---
 superset/extensions/metadb.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/superset/extensions/metadb.py b/superset/extensions/metadb.py
index 79a3c446c4..17e9f2850c 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
@@ -407,7 +407,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


[superset] 02/02: Fix autoincrement

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch fix-count-meta-db
in repository https://gitbox.apache.org/repos/asf/superset.git

commit e079bfa90204a5ec129865bca914d14d77da5c48
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Aug 23 12:43:06 2023 -0700

    Fix autoincrement
---
 superset/extensions/metadb.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/superset/extensions/metadb.py b/superset/extensions/metadb.py
index 17e9f2850c..50147a0a8b 100644
--- a/superset/extensions/metadb.py
+++ b/superset/extensions/metadb.py
@@ -397,6 +397,9 @@ class SupersetShillelaghAdapter(Adapter):
                 raise ProgrammingError(f"Invalid rowid specified: {row_id}")
             row[self._rowid] = row_id
 
+        if self._table.c[self._rowid].autoincrement and row[self._rowid] is None:
+            row.pop(self._rowid)
+
         query = self._table.insert().values(**row)
 
         with self.engine_context() as engine: