我正在尝试从 Firebird 数据库中的表中获取数据。到目前为止,我已经成功地建立了连接并获得了表名。在此处的其他一些帖子之后,我已经设法使用光标函数“选择”(无论这意味着什么)我想要读取的数据库,但我无法检索信息并在 Pandas 中使用它,即我想要的是。
这是我的代码,我希望你能帮助我解决这个问题:
#Connection is made
con=fdb.connect(dsn=r'C:\table.FDB',user='SYSD', password='key')
#I don't know what this is for, but it helps me get the table names and somehow I think I'm getting closer.
schema1=fdb.schema.Schema()
schema1.bind(con)
for i in range(len(schema1.tables)):
print(schema1.tables[i].name)
#This I got it from this post that said it would retrieve the data, but I just don't know how to get it: https://stackoverflow.com/questions/64826318/extract-data-from-a-firebird-database-with-python-fdb-module
cur1=con.cursor()
cur1.execute('select * from "INVE04"')
#I get the following:
<fdb.fbcore.Cursor at 0x2b213a0fe20>
接下来我应该怎么做才能读取数据?我不熟悉 Firebird,所以查阅文档我找不到任何方法或方式来读取/提取/使用每个表中的数据。我在这里走对了吗?