diff options
author | Alexey Bashtanov <alexey@brandwatch.com> | 2020-06-18 15:40:45 +0100 |
---|---|---|
committer | Alexey Bashtanov <alexey@brandwatch.com> | 2020-06-18 15:40:45 +0100 |
commit | 96f0f63de25ed2ce6c9f5541ff8d36a64f18b599 (patch) | |
tree | 5a483eb47c03826066227d11ae82d986811a198d | |
parent | 779a1370ceeac130de07edc0510f2c55846be1bd (diff) | |
download | psycopg2-96f0f63de25ed2ce6c9f5541ff8d36a64f18b599.tar.gz |
dictcursor-docs-improvement
-rw-r--r-- | doc/src/extras.rst | 4 | ||||
-rw-r--r-- | lib/extras.py | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/src/extras.rst b/doc/src/extras.rst index bc47b30..eed049c 100644 --- a/doc/src/extras.rst +++ b/doc/src/extras.rst @@ -41,8 +41,8 @@ If you want to use a `!connection` subclass you can pass it as the Dictionary-like cursor ^^^^^^^^^^^^^^^^^^^^^^ -The dict cursors allow to access to the retrieved records using an interface -similar to the Python dictionaries instead of the tuples. +The dict cursors allow to access to the attributes of retrieved records +using an interface similar to the Python dictionaries instead of the tuples. >>> dict_cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) >>> dict_cur.execute("INSERT INTO test (num, data) VALUES(%s, %s)", diff --git a/lib/extras.py b/lib/extras.py index ccb8b3f..135a3fb 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -130,7 +130,10 @@ class DictConnection(_connection): class DictCursor(DictCursorBase): - """A cursor that keeps a list of column name -> index mappings.""" + """A cursor that keeps a list of column name -> index mappings__. + + .. __: https://docs.python.org/glossary.html#term-mapping + """ def __init__(self, *args, **kwargs): kwargs['row_factory'] = DictRow |