Database settings are configured.

This commit is contained in:
Артём Алейкин 2024-10-08 22:27:17 +04:00
parent 2bf1ec6fdf
commit c08fc79fac
2 changed files with 10 additions and 1 deletions

9
database/database.py Normal file
View File

@ -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()

View File

@ -1,5 +1,5 @@
from sqlalchemy import Column, Integer, String, Float from sqlalchemy import Column, Integer, String, Float
from database import Base from database.database import Base
class Laptop(Base): class Laptop(Base):
__tablename__ = "laptops" __tablename__ = "laptops"