]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-96165: Clarify omitting the FROM clause in SQLite queries (GH-106513) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 11 Jul 2023 20:31:16 +0000 (13:31 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jul 2023 20:31:16 +0000 (22:31 +0200)
(cherry picked from commit fc7ff1af457e27b7d9752600b3436641be90f598)

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Doc/library/sqlite3.rst

index 3ca8ea9011c7e03703f7802b7c7f8683f673385a..26f4bfd06f5bbc16e535d99ca6222114f316970f 100644 (file)
@@ -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: