我正在插入一个由两列数据组成的元组。我没有收到插入错误,但我无法看到数据库中的数据。你知道吗
我的数据
output = ((5153419, 5178566), (5153419, 5178568), (5153419, 5178565), (5153419, 5178562), (5153419, 5178567), (5153419, 5178563), (5153419, 5178561), (5153419, 5178564))
只是在一个单表数据库中做一个基本的插入。你知道吗
connection = sqlite3.connect("test_database.db")
c = connection.cursor()
c.execute("DROP TABLE IF EXISTS Meeting")
c.execute("CREATE TABLE Meeting(MeetingID INT, RaceID INT)")
c.executemany("INSERT INTO Meeting VALUES(?,?)", output)
c.execute("SELECT MeetingID, RaceID from Meeting")
如果我用fetchall检查数据返回。你知道吗
for row in c.fetchall():
print(row)
## Output
[saythrenshaw@localhost racing]$ /usr/bin/python3 /home/saythrenshaw/racing/parse_nsw.py
(5153419, 5178566)
(5153419, 5178568)
(5153419, 5178565)
(5153419, 5178562)
(5153419, 5178567)
(5153419, 5178563)
(5153419, 5178561)
(5153419, 5178564)
不明白为什么如果它从游标连接返回,为什么SQLITE或DBeaver的DB Browser不能在我的表中看到任何数据。 数据是否真的存在,或者连接是否以某种方式“保存数据”。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐