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

Implement Row objects interface #24

Open
avinassh opened this issue Dec 4, 2023 · 0 comments
Open

Implement Row objects interface #24

avinassh opened this issue Dec 4, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@avinassh
Copy link
Member

avinassh commented Dec 4, 2023

Docs: https://docs.python.org/3.11/library/sqlite3.html#row-objects and https://docs.python.org/3.11/library/sqlite3.html#sqlite3-howto-row-factory

This lets us do things like following:

>>> res = con.execute("SELECT 'Earth' AS name, 6378 AS radius")
>>> row = res.fetchone()

>>> row.keys()
['name', 'radius']

>>> row[0]         # Access by index.
'Earth'

>>> row["name"]    # Access by name.
'Earth'

>>> row["RADIUS"]  # Column names are case-insensitive.
6378
@penberg penberg added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Mar 10, 2024
@penberg penberg added this to the 0.1 milestone Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants