Skip to content

Commit

Permalink
Show an example of a custom Record class
Browse files Browse the repository at this point in the history
This demonstrates a dot-notation implementation as suggested by this
FAQ item.
  • Loading branch information
jparise committed Oct 4, 2022
1 parent 5f908e6 commit 6b3e8fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/faq.rst
Expand Up @@ -34,6 +34,12 @@ class that implements dot-notation via the ``record_class`` argument to
:func:`connect() <asyncpg.connection.connect>` or any of the Record-returning
methods.

.. code-block:: python
class MyRecord(asyncpg.Record):
def __getattr__(self, name):
return self[name]
Why can't I use a :ref:`cursor <asyncpg-api-cursor>` outside of a transaction?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 6b3e8fe

Please sign in to comment.