从Pyhton3连接Sqlite3内存数据库的问题

时间:2018-12-04 00:05:48

标签: python-3.x sqlite in-memory-database

在尝试从Python3.4连接到sqlite3中的内存数据库时遇到问题。我正在使用以下代码:

conn = sqlite3.connect('/data/smc/smcdm.db')
c= conn.cursor()
c.execute("ATTACH DATABASE 'file:/dev:/shm/bacnet_values.db?cache=shared' AS bac_v")
db_cursor_system = c.execute("SELECT dm_ver, bacnet_ver, iot_ver, 
smc_db_ver, system_version from system_details")
for row in db_cursor_system:
    print ("dm_ver = ", row[0])
    print ("bacnet_ver = ", row[1])
    print ("iot_ver = ", row[2])
    print ("smc_db_ver =", row[3]);
    print ("system_version =", row[4]);
conn.commit
c.fetchall()

我遇到以下错误:

 sqlite3.OperationalError: unable to open database: file::/dev:/shm/bacnet_values.db?cache=shared

任何人都可以帮忙,谢谢!

0 个答案:

没有答案