Skip to content

Commit 5236ee9

Browse files
methanemiss-islington
authored andcommitted
Doc: Correct sqlite3 API descriptions and SQL examples (GH-162193)
(cherry picked from commit 6ffa102) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
1 parent 9664339 commit 5236ee9

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎Doc/library/sqlite3.rst‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -448,18 +448,19 @@ Module constants
448448
.. code-block:: sql
449449
450450
CREATE TABLE test(
451-
i integer primary key, ! will look up a converter named "integer"
452-
p point, ! will look up a converter named "point"
453-
n number(10) ! will look up a converter named "number"
451+
i integer primary key, -- will look up a converter named "integer"
452+
p point, -- will look up a converter named "point"
453+
n number(10) -- will look up a converter named "number"
454454
)
455455
456456
This flag may be combined with :const:`PARSE_COLNAMES` using the ``|``
457457
(bitwise or) operator.
458458

459459
.. note::
460460

461-
Generated fields (for example ``MAX(p)``) are returned as :class:`str`.
462-
Use :const:`!PARSE_COLNAMES` to enforce types for such queries.
461+
Expressions such as ``MAX(p)`` have no declared type, so their results use
462+
the :ref:`default type conversions <sqlite3-types>`.
463+
Use :const:`!PARSE_COLNAMES` to specify a converter for such expressions.
463464

464465
.. data:: PARSE_COLNAMES
465466

@@ -472,7 +473,7 @@ Module constants
472473

473474
.. code-block:: sql
474475
475-
SELECT MAX(p) as "p [point]" FROM test; ! will look up converter "point"
476+
SELECT MAX(p) as "p [point]" FROM test; -- will look up converter "point"
476477
477478
This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|``
478479
(bitwise or) operator.
@@ -820,7 +821,7 @@ Connection objects
820821
* ``finalize()``: Return the final result of the aggregate as
821822
:ref:`a type natively supported by SQLite <sqlite3-types>`.
822823

823-
The number of arguments that the ``step()`` and ``value()`` methods
824+
The number of arguments that the ``step()`` and ``inverse()`` methods
824825
must accept is controlled by *num_params*.
825826

826827
Set to ``None`` to remove an existing SQL aggregate window function.
@@ -1163,8 +1164,8 @@ Connection objects
11631164
``ATTACH DATABASE`` SQL statement.
11641165

11651166
:param float sleep:
1166-
The number of seconds to sleep between successive attempts
1167-
to back up remaining pages.
1167+
The number of seconds to wait before retrying a backup step
1168+
when the database is busy or locked.
11681169

11691170
Example 1, copy an existing database into another:
11701171

@@ -1384,8 +1385,7 @@ Connection objects
13841385
This read-only attribute corresponds to the low-level SQLite
13851386
`autocommit mode`_.
13861387

1387-
``True`` if a transaction is active (there are uncommitted changes),
1388-
``False`` otherwise.
1388+
``True`` if a transaction is active, ``False`` otherwise.
13891389

13901390
.. versionadded:: 3.2
13911391

@@ -2145,7 +2145,7 @@ The coordinate pair will be stored as a text string in the database,
21452145
using a semicolon to separate the coordinates.
21462146
This can be implemented by adding a ``__conform__(self, protocol)``
21472147
method which returns the adapted value.
2148-
The object passed to *protocol* will be of type :class:`PrepareProtocol`.
2148+
The parameter *protocol* will be :class:`PrepareProtocol`.
21492149

21502150
.. testcode::
21512151

@@ -2416,7 +2416,7 @@ or if :attr:`~Connection.autocommit` is ``True``,
24162416
the context manager does nothing.
24172417

24182418
.. note::
2419-
The context manager neither implicitly opens a new transaction
2419+
The context manager neither implicitly opens a new transaction on entry
24202420
nor closes the connection. If you need a closing context manager, consider
24212421
using :meth:`contextlib.closing`.
24222422

@@ -2464,8 +2464,8 @@ Some useful URI tricks include:
24642464
OperationalError: attempt to write a readonly database
24652465
>>> con.close()
24662466

2467-
* Do not implicitly create a new database file if it does not already exist;
2468-
will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:
2467+
* Open an existing database in read/write mode.
2468+
If the file does not exist, :func:`connect` raises :exc:`OperationalError`:
24692469

24702470
.. doctest::
24712471

0 commit comments

Comments
 (0)