def cr_Compteur(nom): session = connect() c = Compteur() c.nom = nom c.val = 1 session.add(c) session.commit() session.close()
from sqlalchemy.orm import sessionmaker from definitions import Base, BASE_NAME from definitions import Client, Produit, Fourn, Stock, Compteur import datetime import random engine = create_engine(BASE_NAME) Base.metadata.bind = engine DBSession = sessionmaker(bind=engine) session = DBSession() #Compteurs r = Compteur() r.nom = "FACTURE" r.val = 1 session.add(r) r = Compteur() r.nom = "COMCLI" r.val = 1 session.add(r) r = Compteur() r.nom = "COMFOU" r.val = 1 session.add(r) session.commit() #Client