]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Allow dialect-specific stringification
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Nov 2020 16:14:22 +0000 (11:14 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Nov 2020 17:45:34 +0000 (12:45 -0500)
commitc6d869f814d2e8ffe03e519c59cf35f7a4927e1c
tree4017104ab8f89f451b60c788262069c91c0451aa
parent89e748d7ad4426077313aaec916b41f999ae5a34
Allow dialect-specific stringification

Dialect-specific constructs such as
:meth:`_postgresql.Insert.on_conflict_do_update` can now stringify in-place
without the need to specify an explicit dialect object.  The constructs,
when called upon for ``str()``, ``print()``, etc. now have internal
direction to call upon their appropriate dialect rather than the
"default"dialect which doesn't know how to stringify these.   The approach
is also adapted to generic schema-level create/drop such as
:class:`_schema.AddConstraint`, which will adapt its stringify dialect to
one indicated by the element within it, such as the
:class:`_postgresql.ExcludeConstraint` object.

mostly towards being able to provide doctest-style
examples for "on conflict" constructs using print statements.

Change-Id: I4b855516fe6dee2df77744c1bb21a373d7fbab93
doc/build/changelog/unreleased_14/dialect_print.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/mysql/dml.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/postgresql/dml.py
lib/sqlalchemy/dialects/postgresql/ext.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/schema.py
test/sql/test_compiler.py