最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Migrating Engine.execute to SQLAlchemy 2.0 - Stack Overflow

programmeradmin3浏览0评论

I am running my Python script using sqlite package sqlalchemy.

In sqlalchemy 1.4 version my statements look like this:

from sqlalchemy import create_engine, text

results = engine.execute(text("""SELECT * from ragas"""))

I am trying to migrate it into sqlalchemy 2.0 version as follows:

from sqlalchemy import create_engine, text

with engine.connect() as connection:

     results = connection.execute(text("""SELECT * from ragas"""))

I am getting the error:

TypeError: 'module' object is not callable.

What is the correct way of writing this code in sqlalchemy 2.0?

发布评论

评论列表(0)

  1. 暂无评论