Some examples use the following SQL trick:
# setup code; we only need a "dummy" connectionimportsqlite3cx=sqlite3.connect(":memory:")
# returns one row with one column: ("a",)row=cx.execute("select 'a' as literal").fetchone()
# do stuff with resultprint(row)Some people may find such examples strange, because:
- we create a connection to an empty database; it is not immediately obvious why we do this
- it may not be immediatly obvious that you can construct a resulting row by using literals in your query
We may consider one or more of the following:
- Add a very short SQL tutorial
- Add an SQL (and/or) SQLite tips and tricks howto
- Explain how SQL queries work (what is a resulting row , etc.)
Originally posted by @erlend-aasland in #96122 (comment)
Linked PRs
Some examples use the following SQL trick:
Some people may find such examples strange, because:
We may consider one or more of the following:
Originally posted by @erlend-aasland in #96122 (comment)
Linked PRs