summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSebastian Bank <sebastian.bank@uni-leipzig.de>2016-04-11 23:16:32 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-06-06 15:53:25 -0400
commit3351f5f93ca1968653becbed7f1ddef7afb96077 (patch)
tree0bc2a08dd5809522e23eed7a47b9f11bf95ad4b2 /doc
parenta5f92314edd45a2e411b0f5b3c4d4bec0c7d92f8 (diff)
downloadsqlalchemy-3351f5f93ca1968653becbed7f1ddef7afb96077.tar.gz
Add IS (NOT) DISTINCT FROM operators
None / True / False render as literals. For SQLite, "IS" is used as SQLite lacks "IS DISTINCT FROM" but its "IS" operator acts this way for NULL. Doctext-author: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: I9227b81f7207b42627a0349d14d40b46aa756cce Pull-request: https://github.com/zzzeek/sqlalchemy/pull/248
Diffstat (limited to 'doc')
-rw-r--r--doc/build/changelog/changelog_11.rst11
-rw-r--r--doc/build/changelog/migration_11.rst24
2 files changed, 35 insertions, 0 deletions
diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst
index 709eaab5e..789a241d0 100644
--- a/doc/build/changelog/changelog_11.rst
+++ b/doc/build/changelog/changelog_11.rst
@@ -134,6 +134,17 @@
:ref:`change_3653`
.. change::
+ :tags: feature, sql
+
+ New :meth:`.ColumnOperators.is_distinct_from` and
+ :meth:`.ColumnOperators.isnot_distinct_from` operators; pull request
+ courtesy Sebastian Bank.
+
+ .. seealso::
+
+ :ref:`change_is_distinct_from`
+
+ .. change::
:tags: bug, orm
:tickets: 3488
diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst
index b217f0420..d9f48fcb1 100644
--- a/doc/build/changelog/migration_11.rst
+++ b/doc/build/changelog/migration_11.rst
@@ -1137,6 +1137,30 @@ will not have much impact on the behavior of the column during an INSERT.
:ticket:`3216`
+.. _change_is_distinct_from:
+
+Support for IS DISTINCT FROM and IS NOT DISTINCT FROM
+------------------------------------------------------
+
+New operators :meth:`.ColumnOperators.is_distinct_from` and
+:meth:`.ColumnOperators.isnot_distinct_from` allow the IS DISTINCT
+FROM and IS NOT DISTINCT FROM sql operation::
+
+ >>> print column('x').is_distinct_from(None)
+ x IS DISTINCT FROM NULL
+
+Handling is provided for NULL, True and False::
+
+ >>> print column('x').isnot_distinct_from(False)
+ x IS NOT DISTINCT FROM false
+
+For SQLite, which doesn't have this operator, "IS" / "IS NOT" is rendered,
+which on SQLite works for NULL unlike other backends::
+
+ >>> from sqlalchemy.dialects import sqlite
+ >>> print column('x').is_distinct_from(None).compile(dialect=sqlite.dialect())
+ x IS NOT NULL
+
.. _change_1957:
Core and ORM support for FULL OUTER JOIN