Skip to content

Commit bf7e925

Browse files
[3.12] gh-96165: Clarify omitting the FROM clause in SQLite queries (GH-106513) (#106645)
(cherry picked from commit fc7ff1a) Co-authored-by: Mariusz Felisiak <[email protected]>
1 parent 46a21f5 commit bf7e925

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
@@ -2522,6 +2522,13 @@ Queries now return :class:`!Row` objects:
25222522
>>> row["RADIUS"] # Column names are case-insensitive.
25232523
6378
25242524

2525+
.. note::
2526+
2527+
The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the
2528+
above example. In such cases, SQLite returns a single row with columns
2529+
defined by expressions, e.g. literals, with the given aliases
2530+
``expr AS alias``.
2531+
25252532
You can create a custom :attr:`~Cursor.row_factory`
25262533
that returns each row as a :class:`dict`, with column names mapped to values:
25272534

0 commit comments

Comments
 (0)