Skip to content

climate_ref.models.provider #

Provider #

Bases: CreatedUpdatedMixin, Base

Represents a provider that can provide diagnostic calculations

Source code in packages/climate-ref/src/climate_ref/models/provider.py
class Provider(CreatedUpdatedMixin, Base):
    """
    Represents a provider that can provide diagnostic calculations
    """

    __tablename__ = "provider"

    id: Mapped[int] = mapped_column(primary_key=True)
    slug: Mapped[str] = mapped_column(unique=True)
    """
    Globally unique identifier for the provider.
    """

    name: Mapped[str] = mapped_column()
    """
    Long name of the provider
    """

    version: Mapped[str] = mapped_column(nullable=False)
    """
    Version of the provider.

    This should map to the package version.
    """

    diagnostics: Mapped[list["Diagnostic"]] = relationship(back_populates="provider")

    def __repr__(self) -> str:
        return f"<Provider slug={self.slug} version={self.version}>"

name = mapped_column() class-attribute instance-attribute #

Long name of the provider

slug = mapped_column(unique=True) class-attribute instance-attribute #

Globally unique identifier for the provider.

version = mapped_column(nullable=False) class-attribute instance-attribute #

Version of the provider.

This should map to the package version.