Module buildstock_query.schema.utilities
Expand source code
from __future__ import annotations
from typing import Union, Any, Sequence
from pydantic import BaseModel
import sqlalchemy as sa
from sqlalchemy.sql.elements import Label
from sqlalchemy.sql.selectable import Subquery
# from buildstock_query import BuildStockQuery # can't import due to circular import
SACol = sa.Column
SALabel = Label
DBColType = Union[SALabel, SACol]
DBTableType = sa.Table
AnyTableType = Union[DBTableType, str, Subquery]
class MappedColumn(BaseModel):
bsq: Any # BuildStockQuery
name: str
mapping_dict: dict
key: Union[Union[DBColType, str], Sequence[Union[DBColType, str]]]
class Config:
arbitrary_types_allowed = True
smart_union = True
AnyColType = Union[DBColType, str, MappedColumn]
Classes
class MappedColumn (**data: Any)
-
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
Expand source code
class MappedColumn(BaseModel): bsq: Any # BuildStockQuery name: str mapping_dict: dict key: Union[Union[DBColType, str], Sequence[Union[DBColType, str]]] class Config: arbitrary_types_allowed = True smart_union = True
Ancestors
- pydantic.main.BaseModel
- pydantic.utils.Representation
Class variables
var Config
var bsq : Any
var key : Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str, Sequence[Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str]]]
var mapping_dict : dict
var name : str