Clear Filters
Clear Filters

Setting a Row Factory for SQLite Database Transactions Using Python

10 views (last 30 days)
I am accessing a SQLite database using Python from Matlab:
>> dbFileName = 'myDatabase.db';
>> sql = py.importlib.import_module('sqlite3');
>> conn = sql.connect(dbFileName);
>> cur = conn.cursor()
% Followed by a SELECT command and a fetchone()
I want to use the row_factory py.sqlite3.Row. By default, the row_factory is set to py.None.
Outside of Matlab, from the Python prompt, I would simply do the following:
>>> con.row_factory = sql.Row
I tried the following from Matlab:
>> con.row_factory = py.sqlite3.Row;
however, the following Matlab error comes up:
Python Error: TypeError: function takes 2 arguments (0 given)
which is referring to py.sqlite3.Row. No luck in investigating sql.Row in the Python help.
Any ideas?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!