feast.infra.online_stores.contrib.cassandra_online_store package
Submodules
feast.infra.online_stores.contrib.cassandra_online_store.cassandra_online_store module
Cassandra/Astra DB online store for Feast.
- exception feast.infra.online_stores.contrib.cassandra_online_store.cassandra_online_store.CassandraInvalidConfig(msg: str)[source]
Bases:
Exception
- class feast.infra.online_stores.contrib.cassandra_online_store.cassandra_online_store.CassandraOnlineStore[source]
Bases:
feast.infra.online_stores.online_store.OnlineStore
Cassandra/Astra DB online store implementation for Feast.
- _cluster
Cassandra cluster to connect to.
- Type
cassandra.cluster.Cluster
- _session
(DataStax Cassandra drivers) session object to issue commands.
- Type
cassandra.cluster.Session
- _prepared_statements
cache of statements prepared by the driver.
- Type
Dict[str, cassandra.query.PreparedStatement]
- online_read(config: feast.repo_config.RepoConfig, table: feast.feature_view.FeatureView, entity_keys: List[feast.types.EntityKey_pb2.EntityKey], requested_features: Optional[List[str]] = None) List[Tuple[Optional[datetime.datetime], Optional[Dict[str, feast.types.Value_pb2.Value]]]] [source]
Read feature values pertaining to the requested entities from the online store.
- Parameters
config – The RepoConfig for the current FeatureStore.
table – Feast FeatureView.
entity_keys – a list of entity keys that should be read from the FeatureStore.
- online_write_batch(config: feast.repo_config.RepoConfig, table: feast.feature_view.FeatureView, data: List[Tuple[feast.types.EntityKey_pb2.EntityKey, Dict[str, feast.types.Value_pb2.Value], datetime.datetime, Optional[datetime.datetime]]], progress: Optional[Callable[[int], Any]]) None [source]
Write a batch of features of several entities to the database.
- Parameters
config – The RepoConfig for the current FeatureStore.
table – Feast FeatureView.
data – a list of quadruplets containing Feature data. Each quadruplet contains an Entity Key, a dict containing feature values, an event timestamp for the row, and the created timestamp for the row if it exists.
progress – Optional function to be called once every mini-batch of rows is written to the online store. Can be used to display progress.
- teardown(config: feast.repo_config.RepoConfig, tables: Sequence[feast.feature_view.FeatureView], entities: Sequence[feast.entity.Entity])[source]
Delete tables from the database.
- Parameters
config – The RepoConfig for the current FeatureStore.
tables – Tables to delete from the feature repo.
- update(config: feast.repo_config.RepoConfig, tables_to_delete: Sequence[feast.feature_view.FeatureView], tables_to_keep: Sequence[feast.feature_view.FeatureView], entities_to_delete: Sequence[feast.entity.Entity], entities_to_keep: Sequence[feast.entity.Entity], partial: bool)[source]
Update schema on DB, by creating and destroying tables accordingly.
- Parameters
config – The RepoConfig for the current FeatureStore.
tables_to_delete – Tables to delete from the Online Store.
tables_to_keep – Tables to keep in the Online Store.
- class feast.infra.online_stores.contrib.cassandra_online_store.cassandra_online_store.CassandraOnlineStoreConfig(*, type: Literal['cassandra'] = 'cassandra', hosts: Optional[List[pydantic.types.StrictStr]] = None, secure_bundle_path: Optional[pydantic.types.StrictStr] = None, port: Optional[pydantic.types.StrictInt] = None, keyspace: pydantic.types.StrictStr = 'feast_keyspace', username: Optional[pydantic.types.StrictStr] = None, password: Optional[pydantic.types.StrictStr] = None, protocol_version: Optional[pydantic.types.StrictInt] = None, load_balancing: Optional[feast.infra.online_stores.contrib.cassandra_online_store.cassandra_online_store.CassandraOnlineStoreConfig.CassandraLoadBalancingPolicy] = None)[source]
Bases:
feast.repo_config.FeastConfigBaseModel
Configuration for the Cassandra/Astra DB online store.
Exactly one of hosts and secure_bundle_path must be provided; depending on which one, the connection will be to a regular Cassandra or an Astra DB instance (respectively).
If connecting to Astra DB, authentication must be provided with username and password being the Client ID and Client Secret of the database token.
- class CassandraLoadBalancingPolicy(*, load_balancing_policy: pydantic.types.StrictStr, local_dc: pydantic.types.StrictStr = 'datacenter1')[source]
Bases:
feast.repo_config.FeastConfigBaseModel
Configuration block related to the Cluster’s load-balancing policy.
- load_balancing_policy: pydantic.types.StrictStr
A stringy description of the load balancing policy to instantiate the cluster with. Supported values:
“DCAwareRoundRobinPolicy” “TokenAwarePolicy(DCAwareRoundRobinPolicy)”
- local_dc: pydantic.types.StrictStr
The local datacenter, usually necessary to create the policy.
- hosts: Optional[List[pydantic.types.StrictStr]]
List of host addresses to reach the cluster.
- keyspace: pydantic.types.StrictStr
Target Cassandra keyspace where all tables will be.
- load_balancing: Optional[feast.infra.online_stores.contrib.cassandra_online_store.cassandra_online_store.CassandraOnlineStoreConfig.CassandraLoadBalancingPolicy]
it will be wrapped into an execution profile if present.
- Type
Details on the load-balancing policy
- password: Optional[pydantic.types.StrictStr]
Password for DB auth, possibly Astra DB token Client Secret.
- port: Optional[pydantic.types.StrictInt]
Port number for connecting to the cluster (optional).
- protocol_version: Optional[pydantic.types.StrictInt]
Explicit specification of the CQL protocol version used.
- secure_bundle_path: Optional[pydantic.types.StrictStr]
Path to the secure connect bundle (for Astra DB; replaces hosts).
- type: Literal['cassandra']
Online store type selector.
- username: Optional[pydantic.types.StrictStr]
Username for DB auth, possibly Astra DB token Client ID.