diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-09 14:58:26 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-09 14:58:26 -0500 |
| commit | 81aa5b376eb80793e3734eb420b82872d2941d6f (patch) | |
| tree | 4da2b193cdf4197580cf05e7794f1dc723b58ad0 /doc | |
| parent | 53da71fcc2e82c1e6f7b174436043c06257af927 (diff) | |
| download | sqlalchemy-81aa5b376eb80793e3734eb420b82872d2941d6f.tar.gz | |
- Literal values within a :class:`.DefaultClause`, which is invoked
when using the :paramref:`.Column.server_default` parameter, will
now be rendered using the "inline" compiler, so that they are rendered
as-is, rather than as bound parameters.
fixes #3087
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/changelog/changelog_10.rst | 17 | ||||
| -rw-r--r-- | doc/build/changelog/migration_10.rst | 35 |
2 files changed, 50 insertions, 2 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 10d6dc786..277fe28f8 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -24,11 +24,24 @@ on compatibility concerns, see :doc:`/changelog/migration_10`. .. change:: + :tags: feature, sql + :tickets: 3087 + + Literal values within a :class:`.DefaultClause`, which is invoked + when using the :paramref:`.Column.server_default` parameter, will + now be rendered using the "inline" compiler, so that they are rendered + as-is, rather than as bound parameters. + + .. seealso:: + + :ref:`change_3087` + + .. change:: :tags: feature, oracle :pullreq: github:152 - Added support for cx_oracle connections to a specific service - name, as opposed to a tns name, by passing ``?service_name=<name>`` + Added support for cx_oracle connections to a specific service + name, as opposed to a tns name, by passing ``?service_name=<name>`` to the URL. Pull request courtesy Sławomir Ehlert. .. change:: diff --git a/doc/build/changelog/migration_10.rst b/doc/build/changelog/migration_10.rst index efb4b26e5..651679dfd 100644 --- a/doc/build/changelog/migration_10.rst +++ b/doc/build/changelog/migration_10.rst @@ -669,6 +669,41 @@ Will render:: The feature can be disabled using :paramref:`.Insert.from_select.include_defaults`. +.. _change_3087: + +Column server defaults now render literal values +------------------------------------------------ + +The "literal binds" compiler flag is switched on when a +:class:`.DefaultClause`, set up by :paramref:`.Column.server_default` +is present as a SQL expression to be compiled. This allows literals +embedded in SQL to render correctly, such as:: + + from sqlalchemy import Table, Column, MetaData, Text + from sqlalchemy.schema import CreateTable + from sqlalchemy.dialects.postgresql import ARRAY, array + from sqlalchemy.dialects import postgresql + + metadata = MetaData() + + tbl = Table("derp", metadata, + Column("arr", ARRAY(Text), + server_default=array(["foo", "bar", "baz"])), + ) + + print(CreateTable(tbl).compile(dialect=postgresql.dialect())) + +Now renders:: + + CREATE TABLE derp ( + arr TEXT[] DEFAULT ARRAY['foo', 'bar', 'baz'] + ) + +Previously, the literal values ``"foo", "bar", "baz"`` would render as +bound parameters, which are useless in DDL. + +:ticket:`3087` + .. _feature_3184: UniqueConstraint is now part of the Table reflection process |
