Warum das Komponieren einer SQLalchemy -Auswahl nicht funktioniertPython

Python-Programme
Anonymous
 Warum das Komponieren einer SQLalchemy -Auswahl nicht funktioniert

Post 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?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post