Skip to content

Commit 6d86623

Browse files
[3.11] gh-96165: Clarify omitting the FROM clause in SQLite queries (GH-106513) (#106646)
(cherry picked from commit fc7ff1a) Co-authored-by: Mariusz Felisiak <[email protected]>
1 parent 3e61e20 commit 6d86623

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Doc/library/sqlite3.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,13 @@ Queries now return :class:`!Row` objects:
23112311
>>> row["RADIUS"] # Column names are case-insensitive.
23122312
6378
23132313

2314+
.. note::
2315+
2316+
The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the
2317+
above example. In such cases, SQLite returns a single row with columns
2318+
defined by expressions, e.g. literals, with the given aliases
2319+
``expr AS alias``.
2320+
23142321
You can create a custom :attr:`~Cursor.row_factory`
23152322
that returns each row as a :class:`dict`, with column names mapped to values:
23162323

0 commit comments

Comments
 (0)