Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-96165: Clarify omitting the FROM clause in SQLite queries. #106513

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

felixxm
Copy link
Contributor

@felixxm felixxm commented Jul 7, 2023

@erlend-aasland
Copy link
Contributor

Thanks, Mariusz! I wonder if we should put these hints in their own how-to.

@CAM-Gerlach and @ezio-melotti, what do you think?

@ezio-melotti
Copy link
Member

I remember noticing the "unusual" query with no FROM clause, and I figured out how it worked from the output. Having a more explicit explanation just after the example makes things clearer. If the note is moved elsewhere it might be harder to find unless you add a link to it. I'm also not entirely sure about what else you were thinking to add in the how-to.

Regarding the note itself, I wonder if the wording could be simplified a bit, since in just two sentences it talks about clauses, statements, row, columns, expressions, literals, and aliases. Even though it's correct and understandable, if the reader is not familiar with all the terms, it might take a couple of re-reads to understand it.

@felixxm
Copy link
Contributor Author

felixxm commented Jul 7, 2023

I wonder if we should put these hints in their own how-to.

I'm not sure if it's worth. For example, in Django we try to avoid duplicating of 3rd-party documentation.

@felixxm
Copy link
Contributor Author

felixxm commented Jul 7, 2023

Regarding the note itself, I wonder if the wording could be simplified a bit, since in just two sentences it talks about clauses, statements, row, columns, expressions, literals, and aliases. Even though it's correct and understandable, if the reader is not familiar with all the terms, it might take a couple of re-reads to understand it.

We could use constant values instead of literals, and names instead of aliases to reduce the number of terms, e.g.

diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index f6a8714519..6d9b1c22ce 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -2523,7 +2523,7 @@ Queries now return :class:`!Row` objects:
 
     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
+    defined by expressions, e.g. constant values, with the given names
     ``expr AS alias``.
 
 You can create a custom :attr:`~Cursor.row_factory`

On the other hand, the term literal is already used multiple times in this page 🤷

@erlend-aasland
Copy link
Contributor

I think 'literal' is fine in programming language docs ;)

@erlend-aasland erlend-aasland merged commit fc7ff1a into python:main Jul 11, 2023
2 checks passed
@erlend-aasland erlend-aasland added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Jul 11, 2023
@miss-islington
Copy link
Contributor

Thanks @felixxm for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @felixxm for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 11, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 11, 2023
@bedevere-bot
Copy link

GH-106645 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jul 11, 2023
@bedevere-bot
Copy link

GH-106646 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 11, 2023
@felixxm
Copy link
Contributor Author

felixxm commented Jul 11, 2023

@erlend-aasland Thanks 👍

@felixxm felixxm deleted the no-from-96165 branch July 11, 2023 20:30
erlend-aasland pushed a commit that referenced this pull request Jul 11, 2023
erlend-aasland pushed a commit that referenced this pull request Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants