Skip to content

Commit 84c99bf

Browse files
authored
Show an example of a custom Record class (#960)
This demonstrates a dot-notation implementation as suggested by this FAQ item.
1 parent 0e73fec commit 84c99bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/faq.rst

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ class that implements dot-notation via the ``record_class`` argument to
3434
:func:`connect() <asyncpg.connection.connect>` or any of the Record-returning
3535
methods.
3636

37+
.. code-block:: python
38+
39+
class MyRecord(asyncpg.Record):
40+
def __getattr__(self, name):
41+
return self[name]
42+
3743
3844
Why can't I use a :ref:`cursor <asyncpg-api-cursor>` outside of a transaction?
3945
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)