Skip to content

Commit

Permalink
[3.12] gh-96165: Clarify omitting the FROM clause in SQLite queries (G…
Browse files Browse the repository at this point in the history
…H-106513) (#106645)

(cherry picked from commit fc7ff1a)

Co-authored-by: Mariusz Felisiak <[email protected]>
  • Loading branch information
miss-islington and felixxm authored Jul 11, 2023
1 parent 46a21f5 commit bf7e925
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2522,6 +2522,13 @@ Queries now return :class:`!Row` objects:
>>> row["RADIUS"] # Column names are case-insensitive.
6378

.. note::

The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the
above example. In such cases, SQLite returns a single row with columns
defined by expressions, e.g. literals, with the given aliases
``expr AS alias``.

You can create a custom :attr:`~Cursor.row_factory`
that returns each row as a :class:`dict`, with column names mapped to values:

Expand Down

0 comments on commit bf7e925

Please sign in to comment.