Untitled

mail@pastecode.io avatar
unknown
plain_text
9 days ago
2.5 kB
2
Indexable
Never
from sqlalchemy import MetaData, Table, Column, Integer, String, Boolean
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped
from config.settings import engine

# Create metadata object
metadata = MetaData()

# Define a base class for declarative mappings
class Base(DeclarativeBase):
    metadata = metadata

# Define the table 'mdm_field_details'
class FieldDetails(Base):
    __tablename__ = 'mdm_field_details'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    label: Mapped[str] = mapped_column(String)
    name: Mapped[str] = mapped_column(String)
    type: Mapped[str] = mapped_column(String)
    order: Mapped[int] = mapped_column(Integer)
    options: Mapped[str] = mapped_column(String)
    format: Mapped[str] = mapped_column(String)
    is_active: Mapped[bool] = mapped_column(Boolean)
    is_deleted: Mapped[bool] = mapped_column(Boolean)

# Define the table 'mdm_product'
class Product(Base):
    __tablename__ = 'mdm_product'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    name: Mapped[str] = mapped_column(String)
    status_id: Mapped[int] = mapped_column(Integer)
    therapeutic_area_id: Mapped[int] = mapped_column(Integer)
    country_id: Mapped[int] = mapped_column(Integer)
    is_active: Mapped[bool] = mapped_column(Boolean)
    is_deleted: Mapped[bool] = mapped_column(Boolean)

# Define the table 'mdm_status'
class Status(Base):
    __tablename__ = 'mdm_status'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    name: Mapped[str] = mapped_column(String)
    description: Mapped[str] = mapped_column(String)

# Define the table 'mdm_therapeutic'
class TherapeuticArea(Base):
    __tablename__ = 'mdm_therapeutic'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    name: Mapped[str] = mapped_column(String)
    description: Mapped[str] = mapped_column(String)

# Define the table 'mdm_countries'
class Country(Base):
    __tablename__ = 'mdm_countries'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    name: Mapped[str] = mapped_column(String)
    formal_name: Mapped[str] = mapped_column(String)
    iso2_country_code: Mapped[str] = mapped_column(String)
    iso3_country_code: Mapped[str] = mapped_column(String)

# Define the table 'mdm_regions'
class Region(Base):
    __tablename__ = 'mdm_regions'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    name: Mapped[str] = mapped_column(String)
    code: Mapped[str] = mapped_column(String)
Leave a Comment