summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-11 20:31:16 (GMT)
committerGitHub <noreply@github.com>2023-07-11 20:31:16 (GMT)
commitbf7e92583dd33aa7e83d5929f2138c5d6957f571 (patch)
tree9d33b8f6346838b7c3ced6cf80181e6733498bba /Doc/library
parent46a21f5c5e99aa3017618c7bb52d3254a6c0257b (diff)
downloadcpython-bf7e92583dd33aa7e83d5929f2138c5d6957f571.zip
cpython-bf7e92583dd33aa7e83d5929f2138c5d6957f571.tar.gz
cpython-bf7e92583dd33aa7e83d5929f2138c5d6957f571.tar.bz2
[3.12] gh-96165: Clarify omitting the FROM clause in SQLite queries (GH-106513) (#106645)
(cherry picked from commit fc7ff1af457e27b7d9752600b3436641be90f598) Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/sqlite3.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 3ca8ea9..26f4bfd 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -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: