
import psycopg2
conn = psycopg2.connect(host="localhost", port=5432, dbname="financial_analyst", user="postgres")
cur = conn.cursor()
cur.execute("SELECT id, ligne, qte, description FROM bt_materiaux WHERE bon_id = 5 ORDER BY ligne")
rows = cur.fetchall()
print("MATERIAUX_BON5:", len(rows))
for r in rows:
    print("LIGNE", r[1], "QTE", r[2], "DESC:", r[3][:80])
conn.close()
