> ... Using the column name as they key, how do I tell APSW/SQLite to
> give me data as tuples in the most efficient manner?
The most efficient is to accept back unnamed tuples. It does duplicate, but a pattern like this works:
for product, price, sku in db.execute("SELECT product, price, sku FROM ....")
> connection.setrowtrace(callback_function) will run the callback for
> every row. Is there a more efficient method?
If you want names, then some code somewhere has to run for every row. I would advise using dataclasses. The next release defaults slots to True for dataclasses saving some memory.
https://rogerbinns.github.io/apsw/ext.html#accessing-result-rows-by-column-name
In summary, the least amount of CPU cycles is bare tuples, the most ergonomic and efficient for names is to use dataclasses
Roger