prompt
stringlengths
45
17.8k
completion
stringlengths
6
107
api
stringlengths
12
42
from typing import TYPE_CHECKING, Any, Dict, Optional, Union from uuid import UUID, uuid4 from pydantic import PositiveFloat, validator from sqlmodel import Column, Field, Relationship, SQLModel from sqlmodel.sql.sqltypes import GUID if TYPE_CHECKING: from .user import User class BaseItem(SQLModel): code: str = Field(description="Item code", min_length=1) name: str = Field(description="Item Name", min_length=1) cost: Optional[float] = Field(description="Production/Buy cost of the item", ge=0) value: PositiveFloat = Field(description="Sugested sell value of item") amount: int = Field(default=0, description="Quantity of itens avaliable", ge=0) class CreateItem(BaseItem): @validator("value") def validate_value(cls, value: Union[str, float], values: Dict[str, Any]) -> float: if isinstance(value, str): if "," in value and "." not in value: value = value.replace(",", ".") value = float(value) if (values.get("cost") or 0) >= value: raise ValueError("The sugested sell value must be higher then buy value!") return value class UpdateItem(BaseItem): id: UUID = Field(description="ID do item") @validator("value") def validate_value(cls, value: Union[str, float], values: Dict[str, Any]) -> float: if isinstance(value, str): value = float(value) if (values.get("cost") or 0) >= value: raise ValueError("The sugested sell value must be higher then buy value!") return value class QueryItem(SQLModel): name: Optional[str] = Field(description="Name of the item for query") code: Optional[str] = Field(description="Code of the item for query") avaliable: Optional[bool] = Field(description="Flag to identify if the item is avaliable") class Item(BaseItem, table=True): __tablename__ = "items" id: UUID = Field(default_factory=uuid4, description="ID do item", sa_column=Column("id", GUID(), primary_key=True)) owner_id: UUID =
Field(description="User ID that owns the file", foreign_key="users.id")
sqlmodel.Field
from typing import TYPE_CHECKING, Any, Dict, Optional, Union from uuid import UUID, uuid4 from pydantic import PositiveFloat, validator from sqlmodel import Column, Field, Relationship, SQLModel from sqlmodel.sql.sqltypes import GUID if TYPE_CHECKING: from .user import User class BaseItem(SQLModel): code: str = Field(description="Item code", min_length=1) name: str = Field(description="Item Name", min_length=1) cost: Optional[float] = Field(description="Production/Buy cost of the item", ge=0) value: PositiveFloat = Field(description="Sugested sell value of item") amount: int = Field(default=0, description="Quantity of itens avaliable", ge=0) class CreateItem(BaseItem): @validator("value") def validate_value(cls, value: Union[str, float], values: Dict[str, Any]) -> float: if isinstance(value, str): if "," in value and "." not in value: value = value.replace(",", ".") value = float(value) if (values.get("cost") or 0) >= value: raise ValueError("The sugested sell value must be higher then buy value!") return value class UpdateItem(BaseItem): id: UUID = Field(description="ID do item") @validator("value") def validate_value(cls, value: Union[str, float], values: Dict[str, Any]) -> float: if isinstance(value, str): value = float(value) if (values.get("cost") or 0) >= value: raise ValueError("The sugested sell value must be higher then buy value!") return value class QueryItem(SQLModel): name: Optional[str] = Field(description="Name of the item for query") code: Optional[str] = Field(description="Code of the item for query") avaliable: Optional[bool] = Field(description="Flag to identify if the item is avaliable") class Item(BaseItem, table=True): __tablename__ = "items" id: UUID = Field(default_factory=uuid4, description="ID do item", sa_column=Column("id", GUID(), primary_key=True)) owner_id: UUID = Field(description="User ID that owns the file", foreign_key="users.id") owner: "User" =
Relationship()
sqlmodel.Relationship
from typing import TYPE_CHECKING, Any, Dict, Optional, Union from uuid import UUID, uuid4 from pydantic import PositiveFloat, validator from sqlmodel import Column, Field, Relationship, SQLModel from sqlmodel.sql.sqltypes import GUID if TYPE_CHECKING: from .user import User class BaseItem(SQLModel): code: str = Field(description="Item code", min_length=1) name: str = Field(description="Item Name", min_length=1) cost: Optional[float] = Field(description="Production/Buy cost of the item", ge=0) value: PositiveFloat = Field(description="Sugested sell value of item") amount: int = Field(default=0, description="Quantity of itens avaliable", ge=0) class CreateItem(BaseItem): @validator("value") def validate_value(cls, value: Union[str, float], values: Dict[str, Any]) -> float: if isinstance(value, str): if "," in value and "." not in value: value = value.replace(",", ".") value = float(value) if (values.get("cost") or 0) >= value: raise ValueError("The sugested sell value must be higher then buy value!") return value class UpdateItem(BaseItem): id: UUID = Field(description="ID do item") @validator("value") def validate_value(cls, value: Union[str, float], values: Dict[str, Any]) -> float: if isinstance(value, str): value = float(value) if (values.get("cost") or 0) >= value: raise ValueError("The sugested sell value must be higher then buy value!") return value class QueryItem(SQLModel): name: Optional[str] = Field(description="Name of the item for query") code: Optional[str] = Field(description="Code of the item for query") avaliable: Optional[bool] = Field(description="Flag to identify if the item is avaliable") class Item(BaseItem, table=True): __tablename__ = "items" id: UUID = Field(default_factory=uuid4, description="ID do item", sa_column=Column("id",
GUID()
sqlmodel.sql.sqltypes.GUID
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID =
Field(foreign_key="tenant.id", index=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID =
Field(foreign_key="contact.contact_id", index=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str =
Field(nullable=False)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool =
Field(nullable=False, default=False)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool =
Field(nullable=False, default=False)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool =
Field(nullable=False, default=False)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str =
Field(nullable=False)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str =
Field(nullable=False, index=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str = Field(nullable=True) credential_exchange_id: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str = Field(nullable=True) credential_exchange_id: str = Field(nullable=True) revoc_reg_id: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str = Field(nullable=True) credential_exchange_id: str = Field(nullable=True) revoc_reg_id: str = Field(nullable=True) revocation_id: str =
Field(nullable=True)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str = Field(nullable=True) credential_exchange_id: str = Field(nullable=True) revoc_reg_id: str = Field(nullable=True) revocation_id: str = Field(nullable=True) credential_preview: dict = Field(default={}, sa_column=Column(JSON)) # --- acapy data # relationships --- contact: Optional[Contact] =
Relationship(back_populates="issuer_credentials")
sqlmodel.Relationship
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str = Field(nullable=True) credential_exchange_id: str = Field(nullable=True) revoc_reg_id: str = Field(nullable=True) revocation_id: str = Field(nullable=True) credential_preview: dict = Field(default={}, sa_column=Column(JSON)) # --- acapy data # relationships --- contact: Optional[Contact] = Relationship(back_populates="issuer_credentials") credential_template: Optional[CredentialTemplate] = Relationship( back_populates="issuer_credentials" ) # --- relationships created_at: datetime = Field( sa_column=Column(TIMESTAMP, nullable=False, server_default=func.now()) ) updated_at: datetime = Field( sa_column=Column( TIMESTAMP, nullable=False, server_default=func.now(), onupdate=func.now() ) ) @classmethod async def get_by_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, issuer_credential_id: uuid.UUID, deleted: bool | None = False, ) -> "IssuerCredential": """Get IssuerCredential by id. Find and return the database CredentialDefinition record Args: db: database session tenant_id: Traction ID of tenant making the call issuer_credential_id: Traction ID of IssuerCredential Returns: The Traction IssuerCredential (db) record Raises: NotFoundError: if the IssuerCredential cannot be found by ID and deleted flag """ q = ( select(cls) .where(cls.tenant_id == tenant_id) .where(cls.issuer_credential_id == issuer_credential_id) .where(cls.deleted == deleted) .options(selectinload(cls.contact), selectinload(cls.credential_template)) ) q_result = await db.execute(q) db_rec = q_result.scalar_one_or_none() if not db_rec: raise NotFoundError( code="issuer_credential.id_not_found", title="Issuer Credential does not exist", detail=f"Issuer Credential does not exist for id<{issuer_credential_id}>", # noqa: E501 ) return db_rec @classmethod async def get_by_credential_exchange_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, credential_exchange_id: str, ) -> "IssuerCredential": """Get IssuerCredential by Credential Exchange ID. Find and return the database IssuerCredential record Args: db: database session tenant_id: Traction ID of tenant making the call credential_exchange_id: acapy message Credential Exchange ID Returns: The Traction IssuerCredential (db) record Raises: NotFoundError: if the IssuerCredential cannot be found by ID and deleted flag """ q = ( select(cls) .where(cls.tenant_id == tenant_id) .where(cls.credential_exchange_id == credential_exchange_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) ) q_result = await db.execute(q) db_rec = q_result.scalar_one_or_none() if not db_rec: raise NotFoundError( code="issuer_credential.credential_exchange_id_not_found", title="Issuer Credential does not exist", detail=f"Issuer Credential does not exist for credential exchange id<{credential_exchange_id}>", # noqa: E501 ) return db_rec @classmethod async def list_by_credential_template_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, credential_template_id: uuid.UUID, ) -> List["IssuerCredential"]: """List by Credential Template ID. Find and return list of Issuer Credential records for Credential Template. tenant_id: Traction ID of tenant making the call credential_template_id: Traction ID of Credential Template Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.credential_template_id == credential_template_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_cred_def_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, cred_def_id: str, ) -> List["IssuerCredential"]: """List by Cred Def ID. Find and return list of Issuer Credential records for Cred. Def. tenant_id: Traction ID of tenant making the call cred_def_id: Traction ID of Credential Definition Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.cred_def_id == cred_def_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_contact_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, contact_id: uuid.UUID, ) -> List["IssuerCredential"]: """List by Contact ID. Find and return list of Issuer Credential records for Contact. tenant_id: Traction ID of tenant making the call contact_id: Traction ID of Contact Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.contact_id == contact_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_tenant_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, ) -> List["IssuerCredential"]: """List by Tenant ID. Find and return list of Issuer Credential records for Tenant. tenant_id: Traction ID of tenant making the call Returns: List of Traction Issuer Credential (db) records in descending order """ q = ( select(cls) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_thread_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, thread_id: str, ) -> List["IssuerCredential"]: """List by Thread ID. Find and return list of Issuer Credential records for Thread ID. tenant_id: Traction ID of tenant making the call thread_id: AcaPy Thread ID of Issuer Credential Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.thread_id == thread_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs class IssuerCredentialTimeline(BaseModel, table=True): """Issuer Credential Timeline. Model for Issuer Credential Timeline table (postgresql specific dialects in use). Timeline represents history of changes to status and/or state. Attributes: issuer_credential_timeline_id: Unique ID in table issuer_credential_id: Traction Issuer Credential ID status: Business and Tenant indicator for Issuer Credential state; independent of AcaPy Credential State state: The underlying AcaPy Credential state created_at: Timestamp when record was created in Traction """ __tablename__ = "issuer_credential_timeline" issuer_credential_timeline_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) issuer_credential_id: uuid.UUID = Field( foreign_key="issuer_credential.issuer_credential_id", index=True ) status: str =
Field(nullable=False)
sqlmodel.Field
"""Issuer Database Tables/Models. Models of the Traction tables for Issuer and related data. """ import uuid from datetime import datetime from typing import List, Optional from sqlalchemy.orm import selectinload from sqlmodel import Field, Relationship from sqlalchemy import ( Column, func, String, select, desc, JSON, text, ) from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP, ARRAY from sqlmodel.ext.asyncio.session import AsyncSession from api.db.models.base import BaseModel from api.db.models.v1.contact import Contact from api.db.models.v1.governance import CredentialTemplate from api.endpoints.models.v1.errors import ( NotFoundError, ) class IssuerCredential(BaseModel, table=True): """Issuer Credential. Model for the Issuer Credential table (postgresql specific dialects in use). This will track Issuer Credentials for the Tenants. Attributes: issuer_credential_id: Traction ID for issuer credential credential_template_id: Traction Credential Template ID contact_id: Traction Contact ID cred_def_id: Credential Definition ID (ledger) tenant_id: Traction Tenant ID status: Business and Tenant indicator for Credential state; independent of AcaPy Credential Exchange state external_reference_id: Set by tenant to correlate this Credential with entity in external system revoked: when True, this credential has been revoked deleted: Issuer Credential "soft" delete indicator. preview_persisted: when True, store the credential attributes and preview tags: Set by tenant for arbitrary grouping of Credentials comment: Comment supplied when issuing credential_preview: attributes (list of name / values ) for offered/issued cred. This will be empty once offer is made and preview_persisted = False. revocation_comment: comment entered when revoking Credential state: The underlying AcaPy credential exchange state thread_id: AcaPy thread id credential_exchange_id: AcaPy id for the credential exchange revoc_reg_id: revocation registry id (needed for revocation) revocation_id: credential revocation id (needed for revocation) created_at: Timestamp when record was created in Traction updated_at: Timestamp when record was last modified in Traction """ __tablename__ = "issuer_credential" issuer_credential_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) credential_template_id: uuid.UUID = Field( foreign_key="credential_template.credential_template_id", index=True ) tenant_id: uuid.UUID = Field(foreign_key="tenant.id", index=True) contact_id: uuid.UUID = Field(foreign_key="contact.contact_id", index=True) status: str = Field(nullable=False) external_reference_id: str = Field(nullable=True) revoked: bool = Field(nullable=False, default=False) deleted: bool = Field(nullable=False, default=False) tags: List[str] = Field(sa_column=Column(ARRAY(String))) preview_persisted: bool = Field(nullable=False, default=False) comment: str = Field(nullable=True) revocation_comment: str = Field(nullable=True) # acapy data --- state: str = Field(nullable=False) cred_def_id: str = Field(nullable=False, index=True) thread_id: str = Field(nullable=True) credential_exchange_id: str = Field(nullable=True) revoc_reg_id: str = Field(nullable=True) revocation_id: str = Field(nullable=True) credential_preview: dict = Field(default={}, sa_column=Column(JSON)) # --- acapy data # relationships --- contact: Optional[Contact] = Relationship(back_populates="issuer_credentials") credential_template: Optional[CredentialTemplate] = Relationship( back_populates="issuer_credentials" ) # --- relationships created_at: datetime = Field( sa_column=Column(TIMESTAMP, nullable=False, server_default=func.now()) ) updated_at: datetime = Field( sa_column=Column( TIMESTAMP, nullable=False, server_default=func.now(), onupdate=func.now() ) ) @classmethod async def get_by_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, issuer_credential_id: uuid.UUID, deleted: bool | None = False, ) -> "IssuerCredential": """Get IssuerCredential by id. Find and return the database CredentialDefinition record Args: db: database session tenant_id: Traction ID of tenant making the call issuer_credential_id: Traction ID of IssuerCredential Returns: The Traction IssuerCredential (db) record Raises: NotFoundError: if the IssuerCredential cannot be found by ID and deleted flag """ q = ( select(cls) .where(cls.tenant_id == tenant_id) .where(cls.issuer_credential_id == issuer_credential_id) .where(cls.deleted == deleted) .options(selectinload(cls.contact), selectinload(cls.credential_template)) ) q_result = await db.execute(q) db_rec = q_result.scalar_one_or_none() if not db_rec: raise NotFoundError( code="issuer_credential.id_not_found", title="Issuer Credential does not exist", detail=f"Issuer Credential does not exist for id<{issuer_credential_id}>", # noqa: E501 ) return db_rec @classmethod async def get_by_credential_exchange_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, credential_exchange_id: str, ) -> "IssuerCredential": """Get IssuerCredential by Credential Exchange ID. Find and return the database IssuerCredential record Args: db: database session tenant_id: Traction ID of tenant making the call credential_exchange_id: acapy message Credential Exchange ID Returns: The Traction IssuerCredential (db) record Raises: NotFoundError: if the IssuerCredential cannot be found by ID and deleted flag """ q = ( select(cls) .where(cls.tenant_id == tenant_id) .where(cls.credential_exchange_id == credential_exchange_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) ) q_result = await db.execute(q) db_rec = q_result.scalar_one_or_none() if not db_rec: raise NotFoundError( code="issuer_credential.credential_exchange_id_not_found", title="Issuer Credential does not exist", detail=f"Issuer Credential does not exist for credential exchange id<{credential_exchange_id}>", # noqa: E501 ) return db_rec @classmethod async def list_by_credential_template_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, credential_template_id: uuid.UUID, ) -> List["IssuerCredential"]: """List by Credential Template ID. Find and return list of Issuer Credential records for Credential Template. tenant_id: Traction ID of tenant making the call credential_template_id: Traction ID of Credential Template Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.credential_template_id == credential_template_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_cred_def_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, cred_def_id: str, ) -> List["IssuerCredential"]: """List by Cred Def ID. Find and return list of Issuer Credential records for Cred. Def. tenant_id: Traction ID of tenant making the call cred_def_id: Traction ID of Credential Definition Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.cred_def_id == cred_def_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_contact_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, contact_id: uuid.UUID, ) -> List["IssuerCredential"]: """List by Contact ID. Find and return list of Issuer Credential records for Contact. tenant_id: Traction ID of tenant making the call contact_id: Traction ID of Contact Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.contact_id == contact_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_tenant_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, ) -> List["IssuerCredential"]: """List by Tenant ID. Find and return list of Issuer Credential records for Tenant. tenant_id: Traction ID of tenant making the call Returns: List of Traction Issuer Credential (db) records in descending order """ q = ( select(cls) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs @classmethod async def list_by_thread_id( cls: "IssuerCredential", db: AsyncSession, tenant_id: uuid.UUID, thread_id: str, ) -> List["IssuerCredential"]: """List by Thread ID. Find and return list of Issuer Credential records for Thread ID. tenant_id: Traction ID of tenant making the call thread_id: AcaPy Thread ID of Issuer Credential Returns: List of Traction IssuerCredential (db) records in descending order """ q = ( select(cls) .where(cls.thread_id == thread_id) .where(cls.tenant_id == tenant_id) .options(selectinload(cls.contact), selectinload(cls.credential_template)) .order_by(desc(cls.updated_at)) ) q_result = await db.execute(q) db_recs = q_result.scalars() return db_recs class IssuerCredentialTimeline(BaseModel, table=True): """Issuer Credential Timeline. Model for Issuer Credential Timeline table (postgresql specific dialects in use). Timeline represents history of changes to status and/or state. Attributes: issuer_credential_timeline_id: Unique ID in table issuer_credential_id: Traction Issuer Credential ID status: Business and Tenant indicator for Issuer Credential state; independent of AcaPy Credential State state: The underlying AcaPy Credential state created_at: Timestamp when record was created in Traction """ __tablename__ = "issuer_credential_timeline" issuer_credential_timeline_id: uuid.UUID = Field( sa_column=Column( UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), ) ) issuer_credential_id: uuid.UUID = Field( foreign_key="issuer_credential.issuer_credential_id", index=True ) status: str = Field(nullable=False) state: str =
Field(nullable=False)
sqlmodel.Field
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("telegram",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("telegram", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("wechat",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("telegram", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("wechat", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("api_endpoint",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("telegram", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("wechat", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("api_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("server_country",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("telegram", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("wechat", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("api_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("server_country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("server_city",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
"""init Revision ID: 3b7e032d2384 Revises: Create Date: 2021-10-01 02:25:02.820531 """ import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alembic. revision = "3b7e032d2384" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "prep", sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("website", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("details", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("p2p_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("node_address", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("status", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("penalty", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("grade", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("last_updated_block", sa.Integer(), nullable=True), sa.Column("last_updated_timestamp", sa.Integer(), nullable=True), sa.Column("created_block", sa.Integer(), nullable=True), sa.Column("created_timestamp", sa.Integer(), nullable=True), sa.Column("logo_256", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_1024", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("logo_svg", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("steemit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("twitter", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("youtube", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("facebook", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("github", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("reddit", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("keybase", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("telegram", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("wechat", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("api_endpoint", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("server_country", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("server_city", sqlmodel.sql.sqltypes.AutoString(), nullable=True), sa.Column("server_type",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
import json import requests import base64, hashlib, hmac, time import email.utils from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import padding from urllib.parse import urlparse from db.db import async_session from models.users import RemoteUser from sqlmodel import select from activitypub.activitystreams import ActivityTypes async def send_activity(private_key: str, user_id: str, target_id: str, body: dict): # 1. Fetch target inbox # 1.1 Check if we know the user's inbox async with async_session() as s: statement =
select(RemoteUser)
sqlmodel.select
from typing import Any, Dict, List from uuid import UUID from sqlalchemy.orm import selectinload from sqlmodel import select from sqlmodel.ext.asyncio.session import AsyncSession from service.crud.base import CRUDBase, ModelType from service.models.models import Topic, TopicBase, TopicCreate, TopicModel, Word class CRUDTopic(CRUDBase[Topic, TopicCreate, TopicBase]): async def get_model_topics( self, db: AsyncSession, *, model_id: UUID, version: int, with_words: bool = False ) -> List[ModelType]: statement = (
select(self.model)
sqlmodel.select
"""domain tag Revision ID: 3321586ad6c4 Revises: <PASSWORD> Create Date: 2021-11-27 19:30:48.062908 """ import sqlalchemy as sa import sqlmodel import sqlmodel.sql.sqltypes from alembic import op # revision identifiers, used by Alembic. revision = "3321586ad6c4" down_revision = "7c2a518ed636" branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.add_column( "domains", sa.Column( "tag",
sqlmodel.sql.sqltypes.AutoString()
sqlmodel.sql.sqltypes.AutoString
from typing import Optional from sqlmodel import Field, SQLModel from alchemical import Alchemical db = Alchemical('sqlite:///users.sqlite', model_class=SQLModel) class User(db.Model, table=True): id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from typing import Optional from sqlmodel import Field, SQLModel from alchemical import Alchemical db = Alchemical('sqlite:///users.sqlite', model_class=SQLModel) class User(db.Model, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str =
Field(max_length=128)
sqlmodel.Field
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with
AsyncSession(self._conn)
sqlmodel.ext.asyncio.session.AsyncSession
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with
AsyncSession(self._conn)
sqlmodel.ext.asyncio.session.AsyncSession
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) await session.delete(row.one()) await session.commit() async def get_row(self, table_model: SQLModel, attribute: str) -> ScalarResult[Any]: model = type(table_model) async with
AsyncSession(self._conn)
sqlmodel.ext.asyncio.session.AsyncSession
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) await session.delete(row.one()) await session.commit() async def get_row(self, table_model: SQLModel, attribute: str) -> ScalarResult[Any]: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) return row async def get_all_row(self, table_model: type[SQLModel]) -> ScalarResult[Any]: async with
AsyncSession(self._conn)
sqlmodel.ext.asyncio.session.AsyncSession
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) await session.delete(row.one()) await session.commit() async def get_row(self, table_model: SQLModel, attribute: str) -> ScalarResult[Any]: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) return row async def get_all_row(self, table_model: type[SQLModel]) -> ScalarResult[Any]: async with AsyncSession(self._conn) as session: return await session.exec(select(table_model)) # type: ignore async def update_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) table = table_model.__dict__ async with
AsyncSession(self._conn)
sqlmodel.ext.asyncio.session.AsyncSession
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) await session.delete(row.one()) await session.commit() async def get_row(self, table_model: SQLModel, attribute: str) -> ScalarResult[Any]: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) return row async def get_all_row(self, table_model: type[SQLModel]) -> ScalarResult[Any]: async with AsyncSession(self._conn) as session: return await session.exec(
select(table_model)
sqlmodel.select
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec(
select(model)
sqlmodel.select
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) await session.delete(row.one()) await session.commit() async def get_row(self, table_model: SQLModel, attribute: str) -> ScalarResult[Any]: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec(
select(model)
sqlmodel.select
""" dayong.operations ~~~~~~~~~~~~~~~~~ Data model operations which include retrieval and update commands. """ from typing import Any import tanjun from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine from sqlmodel import SQLModel, select from sqlmodel.engine.result import ScalarResult from sqlmodel.ext.asyncio.session import AsyncSession from dayong.abc import Database from dayong.core.configs import DayongConfig, DayongDynamicLoader class DatabaseImpl(Database): """Implementaion of a database connection for transacting and interacting with database tables —those that derive from SQLModel. """ _conn: AsyncEngine @staticmethod async def update(instance: Any, update: Any) -> Any: """Overwrite value of class attribute. Args: instance (Any): A Class instance. update (Any): A dictionary containing the attributes to be overwritten. Returns: Any: A class instance with updated attribute values. """ for key, value in update.items(): setattr(instance, key, value) return instance async def connect( self, config: DayongConfig = tanjun.injected(type=DayongConfig) ) -> None: self._conn = create_async_engine( config.database_uri if config.database_uri else DayongDynamicLoader().load().database_uri ) async def create_table(self) -> None: async with self._conn.begin() as conn: await conn.run_sync(SQLModel.metadata.create_all) async def add_row(self, table_model: SQLModel) -> None: async with AsyncSession(self._conn) as session: session.add(table_model) await session.commit() async def remove_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) await session.delete(row.one()) await session.commit() async def get_row(self, table_model: SQLModel, attribute: str) -> ScalarResult[Any]: model = type(table_model) async with AsyncSession(self._conn) as session: # Temp ignore incompatible type passed to `exec()`. See: # https://github.com/tiangolo/sqlmodel/issues/54 # https://github.com/tiangolo/sqlmodel/pull/58 row: ScalarResult[Any] = await session.exec( select(model).where( getattr(model, attribute) == getattr(table_model, attribute) ) # type: ignore ) return row async def get_all_row(self, table_model: type[SQLModel]) -> ScalarResult[Any]: async with AsyncSession(self._conn) as session: return await session.exec(select(table_model)) # type: ignore async def update_row(self, table_model: SQLModel, attribute: str) -> None: model = type(table_model) table = table_model.__dict__ async with AsyncSession(self._conn) as session: row: ScalarResult[Any] = await session.exec(
select(model)
sqlmodel.select
from sqlmodel import Field, SQLModel from pydantic import EmailStr from fastapi_utils.guid_type import GUID, GUID_DEFAULT_SQLITE import uuid class User(SQLModel, table=True): id: str = Field(default=str(GUID_DEFAULT_SQLITE())) email: EmailStr =
Field(primary_key=True)
sqlmodel.Field
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates from geoalchemy2.types import Geometry from sqlmodel import Session, cast, select from .database import engine from .models import Country app = FastAPI() templates = Jinja2Templates(directory="geo_info_svg/templates") @app.get("/", response_class=HTMLResponse) async def test(request: Request): with
Session(engine)
sqlmodel.Session
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates from geoalchemy2.types import Geometry from sqlmodel import Session, cast, select from .database import engine from .models import Country app = FastAPI() templates = Jinja2Templates(directory="geo_info_svg/templates") @app.get("/", response_class=HTMLResponse) async def test(request: Request): with Session(engine) as session: countries = session.exec( select( # type: ignore Country.name, Country.population,
cast(Country.geometry, Geometry)
sqlmodel.cast
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates from geoalchemy2.types import Geometry from sqlmodel import Session, cast, select from .database import engine from .models import Country app = FastAPI() templates = Jinja2Templates(directory="geo_info_svg/templates") @app.get("/", response_class=HTMLResponse) async def test(request: Request): with Session(engine) as session: countries = session.exec( select( # type: ignore Country.name, Country.population, cast(Country.geometry, Geometry).ST_XMin(),
cast(Country.geometry, Geometry)
sqlmodel.cast
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates from geoalchemy2.types import Geometry from sqlmodel import Session, cast, select from .database import engine from .models import Country app = FastAPI() templates = Jinja2Templates(directory="geo_info_svg/templates") @app.get("/", response_class=HTMLResponse) async def test(request: Request): with Session(engine) as session: countries = session.exec( select( # type: ignore Country.name, Country.population, cast(Country.geometry, Geometry).ST_XMin(), cast(Country.geometry, Geometry).ST_YMin(),
cast(Country.geometry, Geometry)
sqlmodel.cast
from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates from geoalchemy2.types import Geometry from sqlmodel import Session, cast, select from .database import engine from .models import Country app = FastAPI() templates = Jinja2Templates(directory="geo_info_svg/templates") @app.get("/", response_class=HTMLResponse) async def test(request: Request): with Session(engine) as session: countries = session.exec( select( # type: ignore Country.name, Country.population, cast(Country.geometry, Geometry).ST_XMin(), cast(Country.geometry, Geometry).ST_YMin(), cast(Country.geometry, Geometry).ST_XMax(),
cast(Country.geometry, Geometry)
sqlmodel.cast
from sqlmodel import create_engine from pyflarum.database.session import FlarumDatabase from pyflarum.database.flarum.core.users import DB_User DATABASE = FlarumDatabase(
create_engine('sqlite:///tests/database/database.db')
sqlmodel.create_engine
from sqlmodel import Field from taskana_api.entities.tasks import TaskBase class Task(TaskBase, table=True): id: int =
Field(primary_key=True)
sqlmodel.Field
import os from sqlmodel import create_engine, Session, select, update from functools import lru_cache from typing import Union from sqlalchemy.exc import NoResultFound engine = create_engine(os.environ.get('DB_CONN')) # Grim hack to get the imports working with crawler and main. # TODO: Split poke models and other common functions out into a separate package the api+crawler can share. # TODO: After split crawler code out into a separate part of the repo and create an individual Docker image for it. try: from poke.poke_model import pokemon as pokemon_model except: from poke_model import pokemon as pokemon_model @lru_cache(maxsize=16) def get_pokemon(poke_id: int) -> pokemon_model: """ Get a pokemon's data from the database from its ID. Args: poke_id: ID of the pokemon you want the data for. Returns: pokemon_model object containing the data for the pokemon found in the DB. Raises: NoResultFound: If there isn't a pokemon in the DB with the passed in ID. """ with
Session(engine)
sqlmodel.Session
import os from sqlmodel import create_engine, Session, select, update from functools import lru_cache from typing import Union from sqlalchemy.exc import NoResultFound engine = create_engine(os.environ.get('DB_CONN')) # Grim hack to get the imports working with crawler and main. # TODO: Split poke models and other common functions out into a separate package the api+crawler can share. # TODO: After split crawler code out into a separate part of the repo and create an individual Docker image for it. try: from poke.poke_model import pokemon as pokemon_model except: from poke_model import pokemon as pokemon_model @lru_cache(maxsize=16) def get_pokemon(poke_id: int) -> pokemon_model: """ Get a pokemon's data from the database from its ID. Args: poke_id: ID of the pokemon you want the data for. Returns: pokemon_model object containing the data for the pokemon found in the DB. Raises: NoResultFound: If there isn't a pokemon in the DB with the passed in ID. """ with Session(engine) as session: poke = session.exec(select(pokemon_model).where(pokemon_model.id == poke_id)).one() return poke def get_total_pokemon() -> int: """ Get the total number of pokemon in the database. Returns: int: Number of pokemon in the database. """ with
Session(engine)
sqlmodel.Session
import os from sqlmodel import create_engine, Session, select, update from functools import lru_cache from typing import Union from sqlalchemy.exc import NoResultFound engine = create_engine(os.environ.get('DB_CONN')) # Grim hack to get the imports working with crawler and main. # TODO: Split poke models and other common functions out into a separate package the api+crawler can share. # TODO: After split crawler code out into a separate part of the repo and create an individual Docker image for it. try: from poke.poke_model import pokemon as pokemon_model except: from poke_model import pokemon as pokemon_model @lru_cache(maxsize=16) def get_pokemon(poke_id: int) -> pokemon_model: """ Get a pokemon's data from the database from its ID. Args: poke_id: ID of the pokemon you want the data for. Returns: pokemon_model object containing the data for the pokemon found in the DB. Raises: NoResultFound: If there isn't a pokemon in the DB with the passed in ID. """ with Session(engine) as session: poke = session.exec(select(pokemon_model).where(pokemon_model.id == poke_id)).one() return poke def get_total_pokemon() -> int: """ Get the total number of pokemon in the database. Returns: int: Number of pokemon in the database. """ with Session(engine) as session: return session.query(pokemon_model).count() def upsert_pokemon(pokemon: Union[pokemon_model, list[pokemon_model]]) -> None: """ Takes an individual, or list of pokemon_models that are to be added or updated in place. Args: pokemon: pokemon_model objects that are to be created/updated in place in the DB """ with
Session(engine)
sqlmodel.Session
import os from sqlmodel import create_engine, Session, select, update from functools import lru_cache from typing import Union from sqlalchemy.exc import NoResultFound engine = create_engine(os.environ.get('DB_CONN')) # Grim hack to get the imports working with crawler and main. # TODO: Split poke models and other common functions out into a separate package the api+crawler can share. # TODO: After split crawler code out into a separate part of the repo and create an individual Docker image for it. try: from poke.poke_model import pokemon as pokemon_model except: from poke_model import pokemon as pokemon_model @lru_cache(maxsize=16) def get_pokemon(poke_id: int) -> pokemon_model: """ Get a pokemon's data from the database from its ID. Args: poke_id: ID of the pokemon you want the data for. Returns: pokemon_model object containing the data for the pokemon found in the DB. Raises: NoResultFound: If there isn't a pokemon in the DB with the passed in ID. """ with Session(engine) as session: poke = session.exec(select(pokemon_model).where(pokemon_model.id == poke_id)).one() return poke def get_total_pokemon() -> int: """ Get the total number of pokemon in the database. Returns: int: Number of pokemon in the database. """ with Session(engine) as session: return session.query(pokemon_model).count() def upsert_pokemon(pokemon: Union[pokemon_model, list[pokemon_model]]) -> None: """ Takes an individual, or list of pokemon_models that are to be added or updated in place. Args: pokemon: pokemon_model objects that are to be created/updated in place in the DB """ with Session(engine) as session: if isinstance(pokemon, list): # TODO: add bulk inserts raise NotImplementedError p = session.exec(
select(pokemon_model)
sqlmodel.select
import os from sqlmodel import create_engine, Session, select, update from functools import lru_cache from typing import Union from sqlalchemy.exc import NoResultFound engine = create_engine(os.environ.get('DB_CONN')) # Grim hack to get the imports working with crawler and main. # TODO: Split poke models and other common functions out into a separate package the api+crawler can share. # TODO: After split crawler code out into a separate part of the repo and create an individual Docker image for it. try: from poke.poke_model import pokemon as pokemon_model except: from poke_model import pokemon as pokemon_model @lru_cache(maxsize=16) def get_pokemon(poke_id: int) -> pokemon_model: """ Get a pokemon's data from the database from its ID. Args: poke_id: ID of the pokemon you want the data for. Returns: pokemon_model object containing the data for the pokemon found in the DB. Raises: NoResultFound: If there isn't a pokemon in the DB with the passed in ID. """ with Session(engine) as session: poke = session.exec(
select(pokemon_model)
sqlmodel.select
import os from sqlmodel import create_engine, Session, select, update from functools import lru_cache from typing import Union from sqlalchemy.exc import NoResultFound engine = create_engine(os.environ.get('DB_CONN')) # Grim hack to get the imports working with crawler and main. # TODO: Split poke models and other common functions out into a separate package the api+crawler can share. # TODO: After split crawler code out into a separate part of the repo and create an individual Docker image for it. try: from poke.poke_model import pokemon as pokemon_model except: from poke_model import pokemon as pokemon_model @lru_cache(maxsize=16) def get_pokemon(poke_id: int) -> pokemon_model: """ Get a pokemon's data from the database from its ID. Args: poke_id: ID of the pokemon you want the data for. Returns: pokemon_model object containing the data for the pokemon found in the DB. Raises: NoResultFound: If there isn't a pokemon in the DB with the passed in ID. """ with Session(engine) as session: poke = session.exec(select(pokemon_model).where(pokemon_model.id == poke_id)).one() return poke def get_total_pokemon() -> int: """ Get the total number of pokemon in the database. Returns: int: Number of pokemon in the database. """ with Session(engine) as session: return session.query(pokemon_model).count() def upsert_pokemon(pokemon: Union[pokemon_model, list[pokemon_model]]) -> None: """ Takes an individual, or list of pokemon_models that are to be added or updated in place. Args: pokemon: pokemon_model objects that are to be created/updated in place in the DB """ with Session(engine) as session: if isinstance(pokemon, list): # TODO: add bulk inserts raise NotImplementedError p = session.exec(select(pokemon_model).where(pokemon_model.id == pokemon.id)) try: p.one() # see if there was a result for that poke_id # TODO: Only update if the values are different than in the DB.
update(pokemon_model)
sqlmodel.update
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str origin_country: Optional[str] = None logo_path: Optional[str] = None movies: List["Movie"] = Relationship( back_populates="production_companies", link_model=ProductionCompanyMovieLink ) def __rich_repr__(self): yield self.name class Collection(SQLModel, table=True): local_id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str origin_country: Optional[str] = None logo_path: Optional[str] = None movies: List["Movie"] = Relationship( back_populates="production_companies", link_model=ProductionCompanyMovieLink ) def __rich_repr__(self): yield self.name class Collection(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str poster_path: Optional[str] = None backdrop_path: Optional[str] = None movies: List["Movie"] =
Relationship(back_populates="collection")
sqlmodel.Relationship
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str origin_country: Optional[str] = None logo_path: Optional[str] = None movies: List["Movie"] = Relationship( back_populates="production_companies", link_model=ProductionCompanyMovieLink ) def __rich_repr__(self): yield self.name class Collection(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str poster_path: Optional[str] = None backdrop_path: Optional[str] = None movies: List["Movie"] = Relationship(back_populates="collection") def __rich_repr__(self): yield self.name class GenreMovieLink(SQLModel, table=True): genre_id: Optional[int] = Field( default=None, foreign_key="genre.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class Genre(SQLModel, table=True): local_id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str origin_country: Optional[str] = None logo_path: Optional[str] = None movies: List["Movie"] = Relationship( back_populates="production_companies", link_model=ProductionCompanyMovieLink ) def __rich_repr__(self): yield self.name class Collection(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str poster_path: Optional[str] = None backdrop_path: Optional[str] = None movies: List["Movie"] = Relationship(back_populates="collection") def __rich_repr__(self): yield self.name class GenreMovieLink(SQLModel, table=True): genre_id: Optional[int] = Field( default=None, foreign_key="genre.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class Genre(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str movies: List["Movie"] = Relationship( back_populates="genres", link_model=GenreMovieLink ) def __rich_repr__(self): yield self.name class Movie(SQLModel, table=True): local_id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str origin_country: Optional[str] = None logo_path: Optional[str] = None movies: List["Movie"] = Relationship( back_populates="production_companies", link_model=ProductionCompanyMovieLink ) def __rich_repr__(self): yield self.name class Collection(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str poster_path: Optional[str] = None backdrop_path: Optional[str] = None movies: List["Movie"] = Relationship(back_populates="collection") def __rich_repr__(self): yield self.name class GenreMovieLink(SQLModel, table=True): genre_id: Optional[int] = Field( default=None, foreign_key="genre.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class Genre(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str movies: List["Movie"] = Relationship( back_populates="genres", link_model=GenreMovieLink ) def __rich_repr__(self): yield self.name class Movie(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) adult: Optional[bool] = None backdrop_path: Optional[str] = None collection_id: Optional[int] = Field( default=None, foreign_key="collection.local_id" ) collection: Optional[Collection] =
Relationship(back_populates="movies")
sqlmodel.Relationship
from datetime import date from typing import List, Optional from rich.console import Console, ConsoleOptions, RenderResult from rich.text import Text from sqlmodel import Field, Relationship, SQLModel class SpokenLanguageMovieLink(SQLModel, table=True): spoken_language_id: Optional[int] = Field( default=None, foreign_key="spoken_language.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class SpokenLanguage(SQLModel, table=True): __tablename__ = "spoken_language" local_id: Optional[int] = Field(default=None, primary_key=True) english_name: Optional[str] = None iso_639_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="spoken_languages", link_model=SpokenLanguageMovieLink ) def __rich_repr__(self): yield self.name class ProductionCountryMovieLink(SQLModel, table=True): production_country_id: Optional[int] = Field( default=None, foreign_key="production_country.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCountry(SQLModel, table=True): __tablename__ = "production_country" local_id: Optional[int] = Field(default=None, primary_key=True) iso_3166_1: Optional[str] = None name: str movies: List["Movie"] = Relationship( back_populates="production_countries", link_model=ProductionCountryMovieLink ) def __rich_repr__(self): yield self.name class ProductionCompanyMovieLink(SQLModel, table=True): production_company_id: Optional[int] = Field( default=None, foreign_key="production_company.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class ProductionCompany(SQLModel, table=True): __tablename__ = "production_company" local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str origin_country: Optional[str] = None logo_path: Optional[str] = None movies: List["Movie"] = Relationship( back_populates="production_companies", link_model=ProductionCompanyMovieLink ) def __rich_repr__(self): yield self.name class Collection(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str poster_path: Optional[str] = None backdrop_path: Optional[str] = None movies: List["Movie"] = Relationship(back_populates="collection") def __rich_repr__(self): yield self.name class GenreMovieLink(SQLModel, table=True): genre_id: Optional[int] = Field( default=None, foreign_key="genre.local_id", primary_key=True ) movie_id: Optional[int] = Field( default=None, foreign_key="movie.local_id", primary_key=True ) class Genre(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) id: int name: str movies: List["Movie"] = Relationship( back_populates="genres", link_model=GenreMovieLink ) def __rich_repr__(self): yield self.name class Movie(SQLModel, table=True): local_id: Optional[int] = Field(default=None, primary_key=True) adult: Optional[bool] = None backdrop_path: Optional[str] = None collection_id: Optional[int] = Field( default=None, foreign_key="collection.local_id" ) collection: Optional[Collection] = Relationship(back_populates="movies") budget: Optional[int] = None genres: List[Genre] = Relationship( back_populates="movies", link_model=GenreMovieLink ) homepage: Optional[str] = None id: int imdb_id: Optional[str] = None original_language: Optional[str] = None original_title: Optional[str] = None overview: Optional[str] = None popularity: Optional[float] = None poster_path: Optional[str] = None production_companies: List[ProductionCompany] = Relationship( back_populates="movies", link_model=ProductionCompanyMovieLink ) production_countries: List[ProductionCountry] = Relationship( back_populates="movies", link_model=ProductionCountryMovieLink ) release_date: Optional[date] =
Field(None, index=True)
sqlmodel.Field
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int =
Field(primary_key=True)
sqlmodel.Field
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int = Field(primary_key=True) class SongRead(SongBase): id: int class SongCreate(SongBase): pass class Increment(SQLModel, table=True): id: int =
Field(primary_key=True)
sqlmodel.Field
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int = Field(primary_key=True) class SongRead(SongBase): id: int class SongCreate(SongBase): pass class Increment(SQLModel, table=True): id: int = Field(primary_key=True) # ############################################################################# class ListingBase(SQLModel): url: str class Listing(ListingBase, table=True): __tablename__ = 'listings' id: int =
Field(primary_key=True)
sqlmodel.Field
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int = Field(primary_key=True) class SongRead(SongBase): id: int class SongCreate(SongBase): pass class Increment(SQLModel, table=True): id: int = Field(primary_key=True) # ############################################################################# class ListingBase(SQLModel): url: str class Listing(ListingBase, table=True): __tablename__ = 'listings' id: int = Field(primary_key=True) images: List["Image"] = Relationship(back_populates="listing", sa_relationship_kwargs={'lazy': 'selectin'}) class ListingRead(ListingBase): id: str # ############################################################################# class ImageBase(SQLModel): url: str size_x: float size_y: float listing_id: Optional[int] =
Field(default=None, foreign_key="listings.id")
sqlmodel.Field
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int = Field(primary_key=True) class SongRead(SongBase): id: int class SongCreate(SongBase): pass class Increment(SQLModel, table=True): id: int = Field(primary_key=True) # ############################################################################# class ListingBase(SQLModel): url: str class Listing(ListingBase, table=True): __tablename__ = 'listings' id: int = Field(primary_key=True) images: List["Image"] = Relationship(back_populates="listing", sa_relationship_kwargs={'lazy': 'selectin'}) class ListingRead(ListingBase): id: str # ############################################################################# class ImageBase(SQLModel): url: str size_x: float size_y: float listing_id: Optional[int] = Field(default=None, foreign_key="listings.id") class Image(ImageBase, table=True): __tablename__ = 'images' id: int =
Field(primary_key=True)
sqlmodel.Field
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int = Field(primary_key=True) class SongRead(SongBase): id: int class SongCreate(SongBase): pass class Increment(SQLModel, table=True): id: int = Field(primary_key=True) # ############################################################################# class ListingBase(SQLModel): url: str class Listing(ListingBase, table=True): __tablename__ = 'listings' id: int = Field(primary_key=True) images: List["Image"] = Relationship(back_populates="listing", sa_relationship_kwargs={'lazy': 'selectin'}) class ListingRead(ListingBase): id: str # ############################################################################# class ImageBase(SQLModel): url: str size_x: float size_y: float listing_id: Optional[int] = Field(default=None, foreign_key="listings.id") class Image(ImageBase, table=True): __tablename__ = 'images' id: int = Field(primary_key=True) listing: Optional[Listing] =
Relationship(back_populates="images", sa_relationship_kwargs={'lazy': 'selectin'})
sqlmodel.Relationship
from typing import Optional from sqlmodel import Field, SQLModel __all__ = ['User'] class User(SQLModel, table=True): id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from typing import Optional from sqlmodel import Field, SQLModel __all__ = ['User'] class User(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) username: str =
Field(index=False, nullable=False)
sqlmodel.Field
from typing import Optional from sqlmodel import Field, SQLModel __all__ = ['User'] class User(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) username: str = Field(index=False, nullable=False) password: str =
Field(index=False, nullable=False)
sqlmodel.Field
from typing import List, Optional from sqlmodel import Field, Relationship, SQLModel class Sport(SQLModel, table=True): id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from typing import List, Optional from sqlmodel import Field, Relationship, SQLModel class Sport(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str athletes: List["Athlete"] =
Relationship(back_populates="sport")
sqlmodel.Relationship
from typing import List, Optional from sqlmodel import Field, Relationship, SQLModel class Sport(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str athletes: List["Athlete"] = Relationship(back_populates="sport") class Athlete(SQLModel, table=True): id: Optional[int] =
Field(default=None, primary_key=True)
sqlmodel.Field
from typing import List, Optional from sqlmodel import Field, Relationship, SQLModel class Sport(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str athletes: List["Athlete"] = Relationship(back_populates="sport") class Athlete(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str sport_id: Optional[int] =
Field(default=None, foreign_key="sport.id")
sqlmodel.Field
from typing import List, Optional from sqlmodel import Field, Relationship, SQLModel class Sport(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str athletes: List["Athlete"] = Relationship(back_populates="sport") class Athlete(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str sport_id: Optional[int] = Field(default=None, foreign_key="sport.id") sport: Optional[Sport] =
Relationship(back_populates="athletes")
sqlmodel.Relationship