Untitled

 avatar
unknown
plain_text
5 months ago
3.1 kB
4
Indexable
from datetime import datetime
from typing import List

from sqlalchemy import TIMESTAMP, BigInteger, Index, Integer, String, Text
from sqlalchemy.orm import Mapped, mapped_column, relationship
from sqlalchemy.orm.base import Mapped

from .base import Base


class Product(Base):
    __tablename__ = "mdm_product"
    __table_args__ = (
        Index("MDM_ID", "MDM_ID"),
        Index("REQUEST_STATUS_ID_idx", "REQUEST_STATUS_ID"),
    )

    id: Mapped[int] = mapped_column("RECORD_ID", BigInteger, primary_key=True)
    mdm_id: Mapped[int] = mapped_column("MDM_ID", Integer, nullable=False)
    series_id: Mapped[int] = mapped_column("SERIES_ID", Integer, nullable=False)
    country_id: Mapped[int] = mapped_column("COUNTRY_ID", Integer, nullable=False)
    product_name: Mapped[str] = mapped_column(
        "PRODUCT_NAME", String(255), nullable=False
    )
    request_status_id: Mapped[int] = mapped_column(
        "REQUEST_STATUS_ID", Integer, nullable=False
    )
    current_record: Mapped[int] = mapped_column(
        "CURRENT_RECORD", Integer, nullable=False
    )
    last_active: Mapped[int] = mapped_column("LAST_ACTIVE", Integer, nullable=False)
    is_deleted: Mapped[int] = mapped_column("IS_DELETED", Integer, nullable=False)
    created_date: Mapped[datetime] = mapped_column(
        "CREATED_DATE", TIMESTAMP, nullable=False
    )
    created_by_id: Mapped[str] = mapped_column(
        "CREATED_BY_ID", String(50), nullable=False
    )
    updated_date: Mapped[datetime] = mapped_column(
        "UPDATED_DATE", TIMESTAMP, nullable=False
    )
    updated_by_id: Mapped[str] = mapped_column(
        "UPDATED_BY_ID", String(50), nullable=False
    )
    reltio_id: Mapped[str] = mapped_column("RELTIO_ID", String(255))
    group_type: Mapped[str] = mapped_column("GROUP_TYPE", String(25))
    janssen_mstr_prdct_nm: Mapped[str] = mapped_column(
        "JANSSEN_MSTR_PRDCT_NM", String(150)
    )
    product_phase: Mapped[str] = mapped_column("PRODUCT_PHASE", String(50))
    jnj_full_compound_id: Mapped[str] = mapped_column(
        "JNJ_FULL_COMPOUND_ID", String(50)
    )
    generic_name: Mapped[str] = mapped_column("GENERIC_NAME", String(150))
    jnj_flag: Mapped[str] = mapped_column("JNJ_FLAG", String(4))
    th_area: Mapped[int] = mapped_column("TH_AREA", Integer)
    product_status: Mapped[str] = mapped_column("PRODUCT_STATUS", String(25))
    ta_sub_type: Mapped[str] = mapped_column("TA_SUB_TYPE", Text)

    downstream_publish: Mapped[List["DownstreamPublish"]] = relationship(
        "DownstreamPublish", uselist=True, back_populates="product"
    )
    product_fields: Mapped[List["ProductField"]] = relationship(
        "ProductField", uselist=True, back_populates="product"
    )
    downstream_products: Mapped[List["DownstreamProduct"]] = relationship(
        "DownstreamProduct", uselist=True, back_populates="product"
    )
    product_category: Mapped[List["ProductCategory"]] = relationship(
        "ProductCategory", uselist=True, back_populates="product"
    )
Editor is loading...
Leave a Comment