Page 1 of 1

Warum das Komponieren einer SQLalchemy -Auswahl nicht funktioniert

Posted: 20 May 2025, 16:39
by Anonymous
Überlegen Sie, ob Sie Snippet folgen: < /p>

Code: Select all

stmt = db.select(Product).where(Product.id == 1)
print(stmt)

stmt = db.select(Product)
stmt.where(Product.id == 1)
print(stmt)
< /code>
Ich würde erwarten, dass gleich STMT gleich ist, aber stattdessen habe ich: < /p>
SELECT product.id, product.code, product."desc", product.unit, product.cost_price, product.sale_price
FROM product
WHERE product.id = :id_1

SELECT product.id, product.code, product."desc", product.unit, product.cost_price, product.sale_price
FROM product
Die letzte stmt enthält nicht den Where -Verschluss.
Warum passiert das?