使用Sqlalchemy,尝试在sql数据库中创建表格

2024-10-02 08:19:13 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的Python脚本中,我在建立连接后使用Sqlalchemy

connection = engine.connect()

data_gov=connection.execute("select * into temp from mytest_1 where FollowersOf ='gov'")
data=data_gov.fetchall()

但是我在我的sql数据库中看不到任何表,也无法获取所有表。请帮助


Tags: from脚本executedatasqlalchemyconnectconnectionwhere
1条回答
网友
1楼 · 发布于 2024-10-02 08:19:13

经过多次尝试,不知何故我自己得到了答案。下面的engine.connect()只是创建了一个代理连接。所以经过几次调整之后

connection = engine.raw_connection()
data_gov=connection.execute("select * into temp from mytest_1 where FollowersOf ='gov'").commit()
connection.close()

而且,您将很高兴在sql数据库中看到一个真正的表,而不仅仅是一个代理

相关问题 更多 >

    热门问题