Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review
  • Loading branch information
erlend-aasland committed Jul 29, 2022
commit 7407e05f1c6a074b678c78167b908633fe7e8965
21 changes: 11 additions & 10 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,9 @@ Connection Objects

.. class:: Connection

Each open SQLite database is represented by a connection object.
A connection object is created with :func:`sqlite3.connect`.
The main purpose of connection objects is creating
:class:`cursors objects <Cursor>`,
Each open SQLite database is represented by a ``Connection`` object,
which is created using :func:`sqlite3.connect`.
Their main purpose is creating :class:`Cursor` objects,
and :ref:`sqlite3-controlling-transactions`.

.. seealso::
Expand Down Expand Up @@ -968,20 +967,22 @@ Connection Objects
Cursor Objects
--------------

A cursor object represents a database cursor,
A ``Cursor`` object represents a `database cursor`_
which is used to execute SQL statements,
and manage the context of a fetch operation.
Cursors are created with :meth:`Connection.cursor`,
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
or by using any of the :ref:`connection shortcut methods
<sqlite3-connection-shortcuts>`.

Cursors objects are :term:`iterators <iterator>`,
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
meaning that if you :meth:`execute` a ``SELECT`` query,
meaning that if you :meth:`~Cursor.execute` a ``SELECT`` query,
you can simply iterate over the cursor to fetch the resulting rows::

for row in cur.execute("select * from data"):
print(row)

.. _database cursor: https://en.wikipedia.org/wiki/Cursor_(databases)

.. class:: Cursor

A :class:`Cursor` instance has the following attributes and methods.
Expand Down Expand Up @@ -1136,13 +1137,13 @@ Row Objects

.. class:: Row

A :class:`Row` instance that serves as a highly optimized
A :class:`Row` instance serves as a highly optimized
:attr:`~Connection.row_factory` for :class:`Connection` objects.
It tries to mimic a :class:`tuple` in most of its features,
Comment thread
erlend-aasland marked this conversation as resolved.
and supports :term:`mapping` access by column name and index, iteration,
representation, equality testing and :func:`len`.
and supports iteration, :func:`repr`, equality testing, :func:`len`,
and :term:`mapping` access by column name and index.

Two row objects are equal if they have equal columns and equal members.
Two row objects compare equal if have equal columns and equal members.

.. method:: keys

Expand Down