我有以下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
我的问题是,如何获取已删除的行数?