libsql-experimental-python icon indicating copy to clipboard operation
libsql-experimental-python copied to clipboard

Implement Row objects interface

Open avinassh opened this issue 2 years ago • 0 comments

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

avinassh avatar Dec 04 '23 11:12 avinassh