diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2019-11-26 17:59:53 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-11-26 17:59:53 +0000 |
| commit | c5d23203b24f48c25eb17284f023f9f30151a229 (patch) | |
| tree | b26ee5ab270c26b28abbfdc30824b9a0e82372fd /lib/sqlalchemy/sql | |
| parent | d9e43c518f90c0a79c05d7e6ea2559aef5157f52 (diff) | |
| parent | 6f99bdf013f3a0637f0544c4c3daeac0392553d6 (diff) | |
| download | sqlalchemy-c5d23203b24f48c25eb17284f023f9f30151a229.tar.gz | |
Merge "Add sequence support for MariaDB 10.3+."
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/crud.py | 12 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index 881ea9fcd..58abc10df 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -534,13 +534,21 @@ def _append_param_insert_pk(compiler, stmt, c, values, kw): no value passed in either; raise an exception. """ + if ( # column has a Python-side default c.default is not None and ( - # and it won't be a Sequence + # and it either is not a sequence, or it is and we support + # sequences and want to invoke it not c.default.is_sequence - or compiler.dialect.supports_sequences + or ( + compiler.dialect.supports_sequences + and ( + not c.default.optional + or not compiler.dialect.sequences_optional + ) + ) ) ) or ( # column is the "autoincrement column" diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 8c325538c..c7d699a5f 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -2281,6 +2281,8 @@ class Sequence(roles.StatementRole, DefaultGenerator): .. seealso:: + :ref:`defaults_sequences` + :class:`.CreateSequence` :class:`.DropSequence` |
