From 9ab4da7018eae8fc86430c24a38f8ffb0a5951ab Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Sat, 22 Aug 2020 00:30:44 +0200 Subject: Updates for MariaDB sequences MariaDB should not run a Sequence if it has optional=True. Additionally, rework the rules in crud.py to accommodate the new combination MariaDB brings us, which is a dialect that supports both cursor.lastrowid, explicit sequences, *and* no support for returning. Co-authored-by: Mike Bayer Fixes: #5528 Change-Id: I9a8ea69a34983affa95dfd22186e2908fdf0d58c --- lib/sqlalchemy/sql/compiler.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 17cacc981..7b917e661 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -669,6 +669,10 @@ class SQLCompiler(Compiled): insert_prefetch = update_prefetch = () + postfetch_lastrowid = False + """if True, and this in insert, use cursor.lastrowid to populate + result.inserted_primary_key. """ + _cache_key_bind_match = None """a mapping that will relate the BindParameter object we compile to those that are part of the extracted collection of parameters -- cgit v1.2.1