Module buildstock_query.schema.query_params
Expand source code
from pydantic import BaseModel, Field
from typing import Optional, Union, Sequence
from typing import Literal
from buildstock_query.schema.utilities import AnyTableType, AnyColType
class AnnualQuery(BaseModel):
enduses: Sequence[AnyColType]
group_by: Sequence[Union[AnyColType, tuple[str, str]]] = Field(default_factory=list)
upgrade_id: str = '0'
sort: bool = True
join_list: Sequence[tuple[AnyTableType, AnyColType, AnyColType]] = Field(default_factory=list)
restrict: Sequence[tuple[AnyColType, Union[str, int, Sequence[Union[int, str]]]]] = Field(default_factory=list)
weights: Sequence[Union[str, tuple, AnyColType]] = Field(default_factory=list)
get_quartiles: bool = False
get_nonzero_count: bool = False
get_query_only: bool = False
limit: Optional[int] = None
class Config:
arbitrary_types_allowed = True
smart_union = True
class TSQuery(AnnualQuery):
split_enduses: bool = False
collapse_ts: bool = False
timestamp_grouping_func: Optional[Literal["month", "day", "hour"]] = None
class SavingsQuery(TSQuery):
annual_only: bool = True
applied_only: bool = False
unload_to: str = ''
partition_by: Sequence[str] = Field(default_factory=list)
class UtilityTSQuery(TSQuery):
query_group_size: int = 20
eiaid_list: Sequence[str]
Classes
class AnnualQuery (**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 AnnualQuery(BaseModel): enduses: Sequence[AnyColType] group_by: Sequence[Union[AnyColType, tuple[str, str]]] = Field(default_factory=list) upgrade_id: str = '0' sort: bool = True join_list: Sequence[tuple[AnyTableType, AnyColType, AnyColType]] = Field(default_factory=list) restrict: Sequence[tuple[AnyColType, Union[str, int, Sequence[Union[int, str]]]]] = Field(default_factory=list) weights: Sequence[Union[str, tuple, AnyColType]] = Field(default_factory=list) get_quartiles: bool = False get_nonzero_count: bool = False get_query_only: bool = False limit: Optional[int] = None class Config: arbitrary_types_allowed = True smart_union = True
Ancestors
- pydantic.main.BaseModel
- pydantic.utils.Representation
Subclasses
Class variables
var Config
var enduses : Sequence[Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str, MappedColumn]]
var get_nonzero_count : bool
var get_quartiles : bool
var get_query_only : bool
var group_by : Sequence[Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str, MappedColumn, tuple[str, str]]]
var join_list : Sequence[tuple[Union[sqlalchemy.sql.schema.Table, str, sqlalchemy.sql.selectable.Subquery], Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str, MappedColumn], Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str, MappedColumn]]]
var limit : Optional[int]
var restrict : Sequence[tuple[Union[sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, str, MappedColumn], Union[str, int, Sequence[Union[int, str]]]]]
var sort : bool
var upgrade_id : str
var weights : Sequence[Union[str, tuple, sqlalchemy.sql.elements.Label, sqlalchemy.sql.schema.Column, MappedColumn]]
class SavingsQuery (**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 SavingsQuery(TSQuery): annual_only: bool = True applied_only: bool = False unload_to: str = '' partition_by: Sequence[str] = Field(default_factory=list)
Ancestors
- TSQuery
- AnnualQuery
- pydantic.main.BaseModel
- pydantic.utils.Representation
Class variables
var annual_only : bool
var applied_only : bool
var partition_by : Sequence[str]
var unload_to : str
class TSQuery (**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 TSQuery(AnnualQuery): split_enduses: bool = False collapse_ts: bool = False timestamp_grouping_func: Optional[Literal["month", "day", "hour"]] = None
Ancestors
- AnnualQuery
- pydantic.main.BaseModel
- pydantic.utils.Representation
Subclasses
Class variables
var collapse_ts : bool
var split_enduses : bool
var timestamp_grouping_func : Optional[Literal['month', 'day', 'hour']]
class UtilityTSQuery (**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 UtilityTSQuery(TSQuery): query_group_size: int = 20 eiaid_list: Sequence[str]
Ancestors
- TSQuery
- AnnualQuery
- pydantic.main.BaseModel
- pydantic.utils.Representation
Class variables
var eiaid_list : Sequence[str]
var query_group_size : int