]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96165: Clarify omitting the FROM clause in SQLite queries (#106513)
authorMariusz Felisiak <felisiak.mariusz@gmail.com>
Tue, 11 Jul 2023 20:09:04 +0000 (22:09 +0200)
committerGitHub <noreply@github.com>
Tue, 11 Jul 2023 20:09:04 +0000 (22:09 +0200)
Doc/library/sqlite3.rst

index bc69387fca8a9389394bd8dede212bee4506e5d7..f6a8714519f59f282b444976e994cc322d1622c2 100644 (file)
@@ -2519,6 +2519,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: