:tickets: 9608
Added ``prepared_statement_name_func`` connection argument option in the
- asyncpg dialect. This option allow passing a callable used to customize
+ asyncpg dialect. This option allows passing a callable used to customize
the name of the prepared statement that will be created by the driver
- when executing the queries.
- Pull request curtesy of Pavel Sirotkin.
+ when executing queries. Pull request courtesy Pavel Sirotkin.
.. seealso::
.. change::
- :tags: usecase, pool
- :tickets: 9625
+ :tags: usecase, engine
+ :tickets: 9613
Added :func:`_sa.create_pool_from_url` and
:func:`_asyncio.create_async_pool_from_url` to create
:tickets: 9628
Fixed bug in ORM Declarative Dataclasses where the
- :func:`_orm.queryable_attribute` and :func:`_orm.column_property`
+ :func:`_orm.query_expression` and :func:`_orm.column_property`
constructs, which are documented as read-only constructs in the context of
a Declarative mapping, could not be used with a
:class:`_orm.MappedAsDataclass` class without adding ``init=False``, which
- in the case of :func:`_orm.queryable_attribute` was not possible as no
+ in the case of :func:`_orm.query_expression` was not possible as no
``init`` parameter was included. These constructs have been modified from a
dataclass perspective to be assumed to be "read only", setting
``init=False`` by default and no longer including them in the pep-681
these fields don't apply to :func:`_orm.column_property` as used in a
Declarative dataclasses configuration where the construct would be
read-only. Also added read-specific parameter
- :paramref:`_orm.queryable_attribute.compare` to
- :func:`_orm.queryable_attribute`; :paramref:`_orm.queryable_attribute.repr`
+ :paramref:`_orm.query_expression.compare` to
+ :func:`_orm.query_expression`; :paramref:`_orm.query_expression.repr`
was already present.
Current Support
~~~~~~~~~~~~~~~
-The feature is enabled for all included SQLAlchemy backends that support
+The feature is enabled for all backend included in SQLAlchemy that support
RETURNING, with the exception of Oracle for which both the cx_Oracle and
OracleDB drivers offer their own equivalent feature. The feature normally takes
place when making use of the :meth:`_dml.Insert.returning` method of an
When using bulk INSERT with RETURNING, it's important to note that most
database backends provide no formal guarantee of the order in which the
-records from RETURNING are sent, including that there is no guarantee that
+records from RETURNING are returned, including that there is no guarantee that
their order will correspond to that of the input records. For applications
that need to ensure RETURNING records can be correlated with input data,
the additional parameter :paramref:`_dml.Insert.returning.sort_by_parameter_order`
statement. This issue can arise if your application uses database proxies
such as PgBouncer to handle connections. One possible workaround is to
use dynamic prepared statement names, which asyncpg now supports through
-an optional name value for the statement name. This allows you to
+an optional ``name`` value for the statement name. This allows you to
generate your own unique names that won't conflict with existing ones.
To achieve this, you can provide a function that will be called every time
a prepared statement is prepared::
https://github.com/sqlalchemy/sqlalchemy/issues/6467
.. warning:: To prevent a buildup of useless prepared statements in
- your application, it's important to use the NullPool poolclass and
- PgBouncer with a configured `DISCARD https://www.postgresql.org/docs/current/sql-discard.html`_
- setup. The DISCARD command is used to release resources held by the db connection,
+ your application, it's important to use the :class:`.NullPool` pool
+ class, and to configure PgBouncer to use `DISCARD <https://www.postgresql.org/docs/current/sql-discard.html>`_
+ when returning connections. The DISCARD command is used to release resources held by the db connection,
including prepared statements. Without proper setup, prepared statements can
accumulate quickly and cause performance issues.
return self.difference(other)
def intersection(self, other: Range[_T]) -> Range[_T]:
- """Compute the intersection of this range with the `other`."""
+ """Compute the intersection of this range with the `other`.
+
+ .. versionadded:: 2.0.10
+
+ """
if self.empty or other.empty or not self.overlaps(other):
return Range(None, None, empty=True)