summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-02-08 14:53:21 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-02-08 14:53:21 -0500
commit660ff51df0433607b12c58a12c7355107c1773f5 (patch)
tree95c43ce2401ee5aee3d8b3dfa6d241c633d23279 /lib/sqlalchemy/dialects/postgresql
parent47aa62abde6eba67802f2f7126cc79fbd95b5d1a (diff)
downloadsqlalchemy-660ff51df0433607b12c58a12c7355107c1773f5.tar.gz
Fixes for public_factory and mysql/pg dml functions
* ensure that the location indicated by public_factory is importable * adjust all of sqlalchemy.sql.expression locations to be correct * support the case where a public_factory is against a function that has another public_factory already, and already replaced the __init__ on the target class * Use mysql.insert(), postgresql.insert(), don't include .dml in the class path. Change-Id: Iac285289455d8d7102349df3814f7cedc758e639
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py12
-rw-r--r--lib/sqlalchemy/dialects/postgresql/dml.py7
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 82c619c85..ceefc20b0 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -304,9 +304,9 @@ or they may be *inferred* by stating the columns and conditions that comprise
the indexes.
SQLAlchemy provides ``ON CONFLICT`` support via the PostgreSQL-specific
-:func:`.postgresql.dml.insert()` function, which provides
-the generative methods :meth:`~.postgresql.dml.Insert.on_conflict_do_update`
-and :meth:`~.postgresql.dml.Insert.on_conflict_do_nothing`::
+:func:`.postgresql.insert()` function, which provides
+the generative methods :meth:`~.postgresql.Insert.on_conflict_do_update`
+and :meth:`~.postgresql.Insert.on_conflict_do_nothing`::
from sqlalchemy.dialects.postgresql import insert
@@ -415,8 +415,8 @@ for UPDATE::
:paramref:`.Insert.on_conflict_do_update.set_` dictionary.
In order to refer to the proposed insertion row, the special alias
-:attr:`~.postgresql.dml.Insert.excluded` is available as an attribute on
-the :class:`.postgresql.dml.Insert` object; this object is a
+:attr:`~.postgresql.Insert.excluded` is available as an attribute on
+the :class:`.postgresql.Insert` object; this object is a
:class:`.ColumnCollection` which alias contains all columns of the target
table::
@@ -452,7 +452,7 @@ parameter, which will limit those rows which receive an UPDATE::
``ON CONFLICT`` may also be used to skip inserting a row entirely
if any conflict with a unique or exclusion constraint occurs; below
this is illustrated using the
-:meth:`~.postgresql.dml.Insert.on_conflict_do_nothing` method::
+:meth:`~.postgresql.Insert.on_conflict_do_nothing` method::
from sqlalchemy.dialects.postgresql import insert
diff --git a/lib/sqlalchemy/dialects/postgresql/dml.py b/lib/sqlalchemy/dialects/postgresql/dml.py
index ec40ae87e..626f81018 100644
--- a/lib/sqlalchemy/dialects/postgresql/dml.py
+++ b/lib/sqlalchemy/dialects/postgresql/dml.py
@@ -23,6 +23,9 @@ class Insert(StandardInsert):
Adds methods for PG-specific syntaxes such as ON CONFLICT.
+ The :class:`.postgresql.Insert` object is created using the
+ :func:`sqlalchemy.dialects.postgresql.insert` function.
+
.. versionadded:: 1.1
"""
@@ -139,7 +142,9 @@ class Insert(StandardInsert):
)
-insert = public_factory(Insert, ".dialects.postgresql.insert")
+insert = public_factory(
+ Insert, ".dialects.postgresql.insert", ".dialects.postgresql.Insert"
+)
class OnConflictClause(ClauseElement):