16 lines
382 B
Python
16 lines
382 B
Python
from lapp import create_app
|
|
import sqlalchemy as sa
|
|
from models import db, Item
|
|
|
|
app = create_app()
|
|
app.app_context().push()
|
|
query = sa.select(Item).where(Item.quantity == 0)
|
|
items = db.session.scalars(query).all()
|
|
|
|
# items=Item.query.filter_by(quantity='').all()
|
|
for i in items:
|
|
print(f"{i.label} {i.quantity} {i.unit}")
|
|
i.quantity = 1
|
|
i.unit = 'x'
|
|
|
|
db.session.commit() |