summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/dml.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2022-01-14 22:00:11 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2022-01-14 22:00:11 +0000
commit07cd49daaadd0a0568444eaeccaa79f79cd15ffc (patch)
treeec6220fb8755c7b8f5be721c9099ab69cba5d82d /lib/sqlalchemy/dialects/postgresql/dml.py
parentb4fe2b83ab3ce8cee1e2f4353dfcbea515b4f8d1 (diff)
parent43f6ae639ca0186f4802255861acdc20f19e702f (diff)
downloadsqlalchemy-07cd49daaadd0a0568444eaeccaa79f79cd15ffc.tar.gz
Merge "initial reorganize for static typing" into main
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/dml.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/dml.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/dml.py b/lib/sqlalchemy/dialects/postgresql/dml.py
index 48b180e81..09dbd9558 100644
--- a/lib/sqlalchemy/dialects/postgresql/dml.py
+++ b/lib/sqlalchemy/dialects/postgresql/dml.py
@@ -17,11 +17,31 @@ from ...sql.base import ColumnCollection
from ...sql.dml import Insert as StandardInsert
from ...sql.elements import ClauseElement
from ...sql.expression import alias
-from ...util.langhelpers import public_factory
__all__ = ("Insert", "insert")
+
+def insert(table):
+ """Construct a PostgreSQL-specific variant :class:`_postgresql.Insert`
+ construct.
+
+ .. container:: inherited_member
+
+ The :func:`sqlalchemy.dialects.postgresql.insert` function creates
+ a :class:`sqlalchemy.dialects.postgresql.Insert`. This class is based
+ on the dialect-agnostic :class:`_sql.Insert` construct which may
+ be constructed using the :func:`_sql.insert` function in
+ SQLAlchemy Core.
+
+ The :class:`_postgresql.Insert` construct includes additional methods
+ :meth:`_postgresql.Insert.on_conflict_do_update`,
+ :meth:`_postgresql.Insert.on_conflict_do_nothing`.
+
+ """
+ return Insert(table)
+
+
SelfInsert = typing.TypeVar("SelfInsert", bound="Insert")
@@ -183,11 +203,6 @@ class Insert(StandardInsert):
return self
-insert = public_factory(
- Insert, ".dialects.postgresql.insert", ".dialects.postgresql.Insert"
-)
-
-
class OnConflictClause(ClauseElement):
stringify_dialect = "postgresql"