如何使用SQLAlchemy通过原始SQL语句获取已删除的行数?

时间:2018-10-15 22:14:50

标签: python sqlalchemy

我有以下Python代码,该代码通过使用SQlAlchemy库删除SQL表中的所有行:

import sqlalchemy

engine = sqlalchemy.create_engine(...)
with engine.connect() as conn:
    query = f"""
    DELETE FROM my_table_name
    """
    result = conn.execute(query)
    # here, I want to print the number of deleted rows

我的问题是,如何获取已删除的行数?

0 个答案:

没有答案