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 20:20:21 UTC

[superset] 01/01: Fix autoincrement

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 7a485ba23773c73a8b36994c0d28c44c7cfa4a37
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Aug 23 12:43:06 2023 -0700

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

diff --git a/superset/extensions/metadb.py b/superset/extensions/metadb.py
index 17e9f2850c..ef2c093475 100644
--- a/superset/extensions/metadb.py
+++ b/superset/extensions/metadb.py
@@ -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: