Delete statement SQLAlchemy

Eg : 1

def delete(self):
titles = request.POST.getall('title')
pages = self.page_q.filter(Page.title.in_(titles))
for page in pages:
Session.delete(page)
Session.commit()

redirect_to('pages')

Eg : 2

from sqlalchemy import delete

d = delete(page_table, page_table.c.id==1)
connection.execute(d)

 

Author: bm on September 12, 2014
Category: SQLAlchemy