Model

The model package contains various classes and functions for managing Firebolt engines and databases.

Model.database

class firebolt.model.database.Database(*, name: ConstrainedStrValue, compute_region_id: RegionKey, id: DatabaseKey = None, description: ConstrainedStrValue = None, emoji: ConstrainedStrValue = None, current_status: str = None, health_status: str = None, data_size_full: int = None, data_size_compressed: int = None, is_system_database: bool = None, storage_bucket_name: str = None, create_time: datetime = None, create_actor: str = None, last_update_time: datetime = None, last_update_actor: str = None, desired_status: str = None)

Bases: FireboltBaseModel

A Firebolt database.

Databases belong to a region and have a description, but otherwise are not configurable.

attach_to_engine(engine: Engine, is_default_engine: bool = False) Binding

Attach an engine to this database.

Parameters
  • engine – The engine to attach.

  • is_default_engine – Whether this engine should be used as default for this database. Only one engine can be set as default for a single database. This will overwrite any existing default.

compute_region_key: RegionKey
create_actor: Optional[str]
create_time: Optional[datetime]
current_status: Optional[str]
data_size_compressed: Optional[int]
data_size_full: Optional[int]
property database_id: Optional[str]
database_key: Optional[DatabaseKey]
delete() Database

Delete a database from Firebolt.

Raises an error if there are any attached engines.

description: Optional[str]
desired_status: Optional[str]
emoji: Optional[str]
get_attached_engines() List[Engine]

Get a list of engines that are attached to this database.

health_status: Optional[str]
is_system_database: Optional[bool]
last_update_actor: Optional[str]
last_update_time: Optional[datetime]
name: str
classmethod parse_obj_with_service(obj: Any, database_service: DatabaseService) Database
storage_bucket_name: Optional[str]
update(description: str) Database

Updates a database description.

class firebolt.model.database.FieldMask(*, paths: Sequence[str])

Bases: FireboltBaseModel

paths: Sequence[str]

Model.engine

class firebolt.model.engine.Engine(*, name: ConstrainedStrValue, compute_region_id: RegionKey, settings: EngineSettings, id: EngineKey = None, description: str = None, emoji: str = None, current_status: EngineStatus = None, current_status_summary: EngineStatusSummary = None, latest_revision_id: EngineRevisionKey = None, endpoint: str = None, endpoint_serving_revision_id: EngineRevisionKey = None, create_time: datetime = None, create_actor: str = None, last_update_time: datetime = None, last_update_actor: str = None, last_use_time: datetime = None, desired_status: str = None, health_status: str = None, endpoint_desired_revision_id: EngineRevisionKey = None)

Bases: FireboltBaseModel

A Firebolt engine. Responsible for performing work (queries, data ingestion).

Engines are configured in Settings and in EngineRevisionSpecification.

attach_to_database(database: Database, is_default_engine: bool = False) Binding

Attach this engine to a database.

Parameters
  • database – Database to which the engine will be attached.

  • is_default_engine – Whether this engine should be used as default for this database. Only one engine can be set as default for a single database. This will overwrite any existing default.

compute_region_key: RegionKey
create_actor: Optional[str]
create_time: Optional[datetime]
current_status: Optional[EngineStatus]
current_status_summary: Optional[EngineStatusSummary]
property database: Optional[Database]
delete() Engine

Delete an Engine from Firebolt.

description: Optional[str]
desired_status: Optional[str]
emoji: Optional[str]
endpoint: Optional[str]
endpoint_desired_revision_key: Optional[EngineRevisionKey]
endpoint_serving_revision_key: Optional[EngineRevisionKey]
property engine_id: str
get_connection() Connection

Get a connection to the attached database, for running queries.

Returns

engine connection instance

Return type

Connection

get_latest() Engine

Get an up-to-date instance of the Engine from Firebolt.

health_status: Optional[str]
key: Optional[EngineKey]
last_update_actor: Optional[str]
last_update_time: Optional[datetime]
last_use_time: Optional[datetime]
latest_revision_key: Optional[EngineRevisionKey]
name: str
classmethod parse_obj_with_service(obj: Any, engine_service: EngineService) Engine
restart(wait_for_startup: bool = True, wait_timeout_seconds: int = 3600) Engine

Restart an engine.

Parameters
  • wait_for_startup – If True, wait for startup to complete. If false, return immediately after requesting startup.

  • wait_timeout_seconds – Number of seconds to wait for startup to complete before raising a TimeoutError.

Returns

The updated Engine from Firebolt.

settings: EngineSettings
start(wait_for_startup: bool = True, wait_timeout_seconds: int = 3600, verbose: bool = False) Engine

Start an engine. If it’s already started, do nothing.

Parameters
  • wait_for_startup – If True, wait for startup to complete. If false, return immediately after requesting startup.

  • wait_timeout_seconds – Number of seconds to wait for startup to complete before raising a TimeoutError.

  • verbose – If True, print dots periodically while waiting for engine startup. If false, do not print any dots.

Returns

The updated Engine from Firebolt.

stop(wait_for_stop: bool = False, wait_timeout_seconds: int = 3600) Engine

Stop an Engine running on Firebolt.

update(name: Optional[str] = None, engine_type: Optional[EngineType] = None, scale: Optional[int] = None, spec: Optional[str] = None, auto_stop: Optional[int] = None, warmup: Optional[WarmupMethod] = None, description: Optional[str] = None, use_spot: Optional[bool] = None) Engine

update the engine, and returns an updated version of the engine, all parameters could be set to None, this would keep the old engine parameter value

class firebolt.model.engine.EngineSettings(*, preset: str, auto_stop_delay_duration: ConstrainedStrValue, minimum_logging_level: str, is_read_only: bool, warm_up: str)

Bases: FireboltBaseModel

Engine Settings.

See Also: EngineRevisionSpecification which also contains engine configuration.

auto_stop_delay_duration: str
classmethod default(engine_type: EngineType = EngineType.GENERAL_PURPOSE, auto_stop_delay_duration: str = '1200s', warm_up: WarmupMethod = WarmupMethod.PRELOAD_INDEXES, minimum_logging_level: str = 'ENGINE_SETTINGS_LOGGING_LEVEL_INFO') EngineSettings
is_read_only: bool
minimum_logging_level: str
preset: str
warm_up: str
class firebolt.model.engine.FieldMask(*, paths: Sequence[str])

Bases: FireboltBaseModel

paths: Sequence[str]
firebolt.model.engine.check_attached_to_database(func: Callable) Callable

(Decorator) Ensure the engine is attached to a database.

firebolt.model.engine.wait(seconds: int, timeout_time: float, error_message: str, verbose: bool) None

Model.engine_revision

class firebolt.model.engine_revision.EngineRevision(*, specification: EngineRevisionSpecification, id: EngineRevisionKey = None, current_status: str = None, create_time: datetime = None, create_actor: str = None, last_update_time: datetime = None, last_update_actor: str = None, desired_status: str = None, health_status: str = None)

Bases: FireboltBaseModel

A Firebolt Engine revision, which contains a Specification (instance types, counts).

As engines are updated with new settings, revisions are created.

create_actor: Optional[str]
create_time: Optional[datetime]
current_status: Optional[str]
desired_status: Optional[str]
health_status: Optional[str]
key: Optional[EngineRevisionKey]
last_update_actor: Optional[str]
last_update_time: Optional[datetime]
specification: EngineRevisionSpecification
class firebolt.model.engine_revision.EngineRevisionSpecification(*, db_compute_instances_type_id: InstanceTypeKey, db_compute_instances_count: PositiveInt, db_compute_instances_use_spot: bool = False, db_version: str = '', proxy_instances_type_id: InstanceTypeKey, proxy_instances_count: PositiveInt = 1, proxy_version: str = '')

Bases: FireboltBaseModel

An EngineRevision Specification.

Notably, it determines which instance types and how many of them its Engine gets.

See Also: Settings, which also contains engine configuration.

db_compute_instances_count: PositiveInt
db_compute_instances_type_key: InstanceTypeKey
db_compute_instances_use_spot: bool
db_version: str
proxy_instances_count: PositiveInt
proxy_instances_type_key: InstanceTypeKey
proxy_version: str

Model.instance_type

class firebolt.model.instance_type.InstanceType(*, id: InstanceTypeKey, name: str, is_spot_available: bool = None, cpu_virtual_cores_count: int = None, memory_size_bytes: int = None, storage_size_bytes: int = None, price_per_hour_cents: float = None, create_time: datetime = None, last_update_time: datetime = None)

Bases: FireboltBaseModel

cpu_virtual_cores_count: Optional[int]
create_time: Optional[datetime]
is_spot_available: Optional[bool]
key: InstanceTypeKey
last_update_time: Optional[datetime]
memory_size_bytes: Optional[int]
name: str
price_per_hour_cents: Optional[float]
storage_size_bytes: Optional[int]

Model.provider

class firebolt.model.provider.Provider(*, id: str, name: str, create_time: datetime = None, display_name: str = None, last_update_time: datetime = None)

Bases: FireboltBaseModel

create_time: Optional[datetime]
display_name: Optional[str]
last_update_time: Optional[datetime]
name: str
provider_id: str

Model.region

class firebolt.model.region.Region(*, id: RegionKey, name: str, display_name: str = None, create_time: datetime = None, last_update_time: datetime = None)

Bases: FireboltBaseModel

create_time: Optional[datetime]
display_name: Optional[str]
key: RegionKey
last_update_time: Optional[datetime]
name: str