From 6d8662381d73982f53d3cc71bf435aa82def8eab Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 11 Jul 2023 13:30:52 -0700 Subject: [PATCH] [3.11] gh-96165: Clarify omitting the FROM clause in SQLite queries (GH-106513) (#106646) (cherry picked from commit fc7ff1af457e27b7d9752600b3436641be90f598) Co-authored-by: Mariusz Felisiak --- Doc/library/sqlite3.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index c99c01b0e5c7..a50be741ce8b 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2311,6 +2311,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: -- 2.47.3