-
-
Notifications
You must be signed in to change notification settings - Fork 116
db.query()
method (renamed db.execute_returning_dicts()
)
#290
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
Comments
Potential names:
I think |
One small problem with the existing method: sqlite-utils/sqlite_utils/db.py Lines 362 to 365 in 8cedc6a
It returns a full list, but what if the user would rather have a generator they can iterate over without loading the results into memory in one go? |
The Python docs say: https://docs.python.org/3/library/sqlite3.html
Looking at the C source code, both So it looks like the most efficient way to iterate over a cursor may well be |
db.execute_returning_dicts()
db.query()
method (renamed db.execute_returning_dicts()
)
Still needs documentation, which will involve rewriting the whole Executing queries section. |
That documentation section is pretty weak at the moment - here's the whole thing:
It does at least cover the two types of parameters, though that could be bulked out. |
The new documentation: https://sqlite-utils.datasette.io/en/latest/python-api.html#executing-queries |
Most of this library deals with lists of Python dictionaries -
.insert_all()
,.rows
,.rows_where()
,.search()
.The
db.execute()
method is the only thing that returns asqlite3
cursor.There is a clumsily named
db.execute_returning_dicts(sql)
method but it's not currently mentioned in the documentation.It needs a better name, and needs to be properly documented.
The text was updated successfully, but these errors were encountered: