필터 지우기
필터 지우기

Setting a Row Factory for SQLite Database Transactions Using Python

조회 수: 4 (최근 30일)
Bob S
Bob S 2020년 11월 5일
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by