[Python-checkins] [3.12] gh-96165: Clarify omitting the FROM clause in SQLite queries (GH-106513) (#106645)
erlend-aasland
webhook-mailer at python.org
Tue Jul 11 16:31:20 EDT 2023
https://github.com/python/cpython/commit/bf7e92583dd33aa7e83d5929f2138c5d6957f571
commit: bf7e92583dd33aa7e83d5929f2138c5d6957f571
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023年07月11日T22:31:16+02:00
summary:
[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 at gmail.com>
files:
M Doc/library/sqlite3.rst
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 3ca8ea9011c7e..26f4bfd06f5bb 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:
More information about the Python-checkins
mailing list