to inspect the current state of the transaction. This can be useful for
debugging, logging, or implementing custom transaction management logic.
-The `!status` property is a `~psycopg.Transaction.Status` enum value:
-please check the enum documentation for the possible values.
+The `!status` property is a `psycopg.Transaction.Status` enum value:
+please check its documentation for the possible values.
Here are a few examples of how to use the `!status` property:
The `!status` property remains accessible after the transaction context has
exited, allowing you to check the final outcome of the transaction even after
-the `!with` block completes. This is particularly useful when you need to log
+the `!with` block has exited. This is particularly useful when you need to log
transaction outcomes or implement retry logic based on the transaction status.
Example: nested templates
-------------------------
-A string template merges literal parts of the query with parameter. It is also
+A string template merges literal parts of the query with parameters. It is also
possible to pass templates to templates in order to compose more and more
complex and dynamic SQL statements.
- More flexible :ref:`composite adaptation<adapt-composite>`: it is now possible
to adapt Python objects to PostgreSQL composites and back even if they are not
sequences or if they take keyword arguments (:ticket:`#932`, :ticket:`#1202`).
-- Cursors are now *iterators*, not only *iterables*. This means you can call
- ``next(cur)`` to fetch the next row (:ticket:`#1064`).
+- Cursors are now iterators_, not just iterables_. This means you can call
+ `next`\ ``(cur)`` or `anext`\ ``(cur)``, which is useful as a :ref:`type-safe
+ expression <typing-fetchone>` (:ticket:`#1064`).
- Add `Cursor.set_result()` and `Cursor.results()` to move across the result
sets of queries executed though `~Cursor.executemany()` or
`~Cursor.execute()` with multiple statements (:tickets:`#1080, #1170`).
- Drop support for Python 3.8 (:ticket:`#976`) and 3.9 (:ticket:`#1056`).
+.. _iterators: https://docs.python.org/3/glossary.html#term-iterator
+.. _iterables: https://docs.python.org/3/glossary.html#term-iterable
+
Current release
---------------