diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-07-11 20:09:04 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-11 20:09:04 (GMT) |
| commit | fc7ff1af457e27b7d9752600b3436641be90f598 (patch) | |
| tree | 38f4df081c5c3df9382727d69ac069ac4479aabe | |
| parent | 4bf43710d1e1f19cc46b116b5d8524f6c75dabfa (diff) | |
| download | cpython-fc7ff1af457e27b7d9752600b3436641be90f598.zip cpython-fc7ff1af457e27b7d9752600b3436641be90f598.tar.gz cpython-fc7ff1af457e27b7d9752600b3436641be90f598.tar.bz2 | |
gh-96165: Clarify omitting the FROM clause in SQLite queries (#106513)
| -rw-r--r-- | Doc/library/sqlite3.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index bc69387f..f6a8714 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -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: |
