SQLAlchemy is there a way to Returning result after Delete execution

前端 未结 1 800
轻奢々
轻奢々 2021-01-14 19:08

I can\'t find equivalent solution about Returning clause

DELETE FROM items
WHERE sub_item_id IN %(sub_item_ids)s
RETURNING item_id, sub_item_id, 


        
相关标签:
1条回答
  • 2021-01-14 20:03

    To execute your query as is use Core constructs:

    stmt = ItemItem.__table__.delete().\
        where(ItemItem.sub_item_id.in_(sub_item_ids)).\
        returning(ItemItem.item_id, ItemItem.sub_item_ids)
    
    results = session.execute(stmt).fetchall()
    
    0 讨论(0)
提交回复
热议问题