diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/dml.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/dml.py | 27 |
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" |
