orm_sqlalchemy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

14 lines
459 B

from sqlalchemy import update, select
from s1_models import *
# update
u = update(cookies).where(cookies.c.cookie_name == "chocolate chip").values(quantity=(cookies.c.quantity + 2))
result = connection.execute(u)
print(result.rowcount)
print(result.last_updated_params())
s = select([cookies]).where(cookies.c.cookie_name == 'chocolate chip')
rp = connection.execute(s)
r = rp.first()
print(r)
for key in r.keys():
print('{:>20}:{}'.format(key, r[key]))