summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-04-03 15:05:27 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-04-04 13:45:06 -0400
commit9f82afea25958910038ec768d81b157d9d2fdc7c (patch)
tree4d5af698d91d4343c07cb856693b3ec6b11c3268 /doc
parent0a44f97cb80fa062927689fb0c4c1b6026c50513 (diff)
downloadsqlalchemy-9f82afea25958910038ec768d81b157d9d2fdc7c.tar.gz
Recognize brackets, quoted_name in SQL Server schema
The SQL Server dialect now allows for a database and/or owner name with a dot inside of it, using brackets explicitly in the string around the owner and optionally the database name as well. In addition, sending the :class:`.quoted_name` construct for the schema name will not split on the dot and will deliver the full string as the "owner". :class:`.quoted_name` is also now available from the ``sqlalchemy.sql`` import space. Change-Id: I77491d63ce47638bd23787d903ccde2f35a9d43d Fixes: #2626
Diffstat (limited to 'doc')
-rw-r--r--doc/build/changelog/changelog_12.rst16
-rw-r--r--doc/build/changelog/migration_12.rst44
2 files changed, 60 insertions, 0 deletions
diff --git a/doc/build/changelog/changelog_12.rst b/doc/build/changelog/changelog_12.rst
index ad9e73160..31c866ee1 100644
--- a/doc/build/changelog/changelog_12.rst
+++ b/doc/build/changelog/changelog_12.rst
@@ -25,6 +25,22 @@
check constraints in 0.9 as part of :ticket:`2742`, which more commonly
feature Core SQL expressions as opposed to plain string expressions.
+ .. change:: 2626
+ :tags: bug, mssql
+ :tickets: 2626
+
+ The SQL Server dialect now allows for a database and/or owner name
+ with a dot inside of it, using brackets explicitly in the string around
+ the owner and optionally the database name as well. In addition,
+ sending the :class:`.quoted_name` construct for the schema name will
+ not split on the dot and will deliver the full string as the "owner".
+ :class:`.quoted_name` is also now available from the ``sqlalchemy.sql``
+ import space.
+
+ .. seealso::
+
+ :ref:`change_2626`
+
.. change:: 3923
:tags: bug, sql
:tickets: 3923
diff --git a/doc/build/changelog/migration_12.rst b/doc/build/changelog/migration_12.rst
index 4c2090e50..c5fe49dca 100644
--- a/doc/build/changelog/migration_12.rst
+++ b/doc/build/changelog/migration_12.rst
@@ -652,3 +652,47 @@ Where the above could create problems particularly with Alembic autogenerate.
:ticket:`3276`
+
+Dialect Improvements and Changes - SQL Server
+=============================================
+
+.. _change_2626:
+
+SQL Server schema names with embedded dots supported
+-----------------------------------------------------
+
+The SQL Server dialect has a behavior such that a schema name with a dot inside
+of it is assumed to be a "database"."owner" identifier pair, which is
+necessarily split up into these separate components during table and component
+reflection operations, as well as when rendering quoting for the schema name so
+that the two symbols are quoted separately. The schema argument can
+now be passed using brackets to manually specify where this split
+occurs, allowing database and/or owner names that themselves contain one
+or more dots::
+
+ Table(
+ "some_table", metadata,
+ Column("q", String(50)),
+ schema="[MyDataBase.dbo]"
+ )
+
+The above table will consider the "owner" to be ``MyDataBase.dbo``, which
+will also be quoted upon render, and the "database" as None. To individually
+refer to database name and owner, use two pairs of brackets::
+
+ Table(
+ "some_table", metadata,
+ Column("q", String(50)),
+ schema="[MyDataBase.SomeDB].[MyDB.owner]"
+ )
+
+Additionally, the :class:`.quoted_name` construct is now honored when
+passed to "schema" by the SQL Server dialect; the given symbol will
+not be split on the dot if the quote flag is True and will be interpreted
+as the "owner".
+
+.. seealso::
+
+ :ref:`multipart_schema_names`
+
+:ticket:`2626`