Skip to content

Commit

Permalink
Create create_contract.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 8, 2024
1 parent 4ca2333 commit 17d7308
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from sqlalchemy import create_engine
from contract_sphere_db.models import Contract, User

engine = create_engine('postgresql://user:password@localhost/contract_sphere_db')

def create_contract(title, description, user_id):
contract = Contract(title=title, description=description, user_id=user_id)
with engine.connect() as conn:
conn.execute(contract.insert())
return contract

0 comments on commit 17d7308

Please sign in to comment.