diff --git a/database/database.py b/database/database.py new file mode 100644 index 0000000..d88797d --- /dev/null +++ b/database/database.py @@ -0,0 +1,9 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +DATABASE_URL = "postgresql://postgres:postgres@localhost/price-builder" + +engine = create_engine(DATABASE_URL) +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) +Base = declarative_base() diff --git a/models/models.py b/models/models.py index 7a507a1..f3d56a8 100644 --- a/models/models.py +++ b/models/models.py @@ -1,5 +1,5 @@ from sqlalchemy import Column, Integer, String, Float -from database import Base +from database.database import Base class Laptop(Base): __tablename__ = "laptops"