feast.infra.offline_stores.contrib.postgres_offline_store package
Subpackages
Submodules
feast.infra.offline_stores.contrib.postgres_offline_store.postgres module
- class feast.infra.offline_stores.contrib.postgres_offline_store.postgres.PostgreSQLOfflineStore[source]
Bases:
feast.infra.offline_stores.offline_store.OfflineStore
- static get_historical_features(config: feast.repo_config.RepoConfig, feature_views: List[feast.feature_view.FeatureView], feature_refs: List[str], entity_df: Union[pandas.core.frame.DataFrame, str], registry: feast.registry.Registry, project: str, full_feature_names: bool = False) feast.infra.offline_stores.offline_store.RetrievalJob [source]
- static pull_all_from_table_or_query(config: feast.repo_config.RepoConfig, data_source: feast.data_source.DataSource, join_key_columns: List[str], feature_name_columns: List[str], timestamp_field: str, start_date: datetime.datetime, end_date: datetime.datetime) feast.infra.offline_stores.offline_store.RetrievalJob [source]
Returns a Retrieval Job for all join key columns, feature name columns, and the event timestamp columns that occur between the start_date and end_date.
Note that join_key_columns, feature_name_columns, timestamp_field, and created_timestamp_column have all already been mapped to column names of the source table and those column names are the values passed into this function.
- Parameters
config – Repo configuration object
data_source – Data source to pull all of the columns from
join_key_columns – Columns of the join keys
feature_name_columns – Columns of the feature names needed
timestamp_field – Timestamp column
start_date – Starting date of query
end_date – Ending date of query
- static pull_latest_from_table_or_query(config: feast.repo_config.RepoConfig, data_source: feast.data_source.DataSource, join_key_columns: List[str], feature_name_columns: List[str], timestamp_field: str, created_timestamp_column: Optional[str], start_date: datetime.datetime, end_date: datetime.datetime) feast.infra.offline_stores.offline_store.RetrievalJob [source]
This method pulls data from the offline store, and the FeatureStore class is used to write this data into the online store. This method is invoked when running materialization (using the feast materialize or feast materialize-incremental commands, or the corresponding FeatureStore.materialize() method. This method pulls data from the offline store, and the FeatureStore class is used to write this data into the online store.
Note that join_key_columns, feature_name_columns, timestamp_field, and created_timestamp_column have all already been mapped to column names of the source table and those column names are the values passed into this function.
- Parameters
config – Repo configuration object
data_source – Data source to pull all of the columns from
join_key_columns – Columns of the join keys
feature_name_columns – Columns of the feature names needed
timestamp_field – Timestamp column
start_date – Starting date of query
end_date – Ending date of query
- class feast.infra.offline_stores.contrib.postgres_offline_store.postgres.PostgreSQLOfflineStoreConfig(*, host: pydantic.types.StrictStr, port: int = 5432, database: pydantic.types.StrictStr, db_schema: pydantic.types.StrictStr = 'public', user: pydantic.types.StrictStr, password: pydantic.types.StrictStr, sslmode: pydantic.types.StrictStr = None, sslkey_path: pydantic.types.StrictStr = None, sslcert_path: pydantic.types.StrictStr = None, sslrootcert_path: pydantic.types.StrictStr = None, type: Literal['postgres'] = 'postgres')[source]
Bases:
feast.infra.utils.postgres.postgres_config.PostgreSQLConfig
- type: Literal['postgres']
- class feast.infra.offline_stores.contrib.postgres_offline_store.postgres.PostgreSQLRetrievalJob(query: Union[str, Callable[[], AbstractContextManager[str]]], config: feast.repo_config.RepoConfig, full_feature_names: bool, on_demand_feature_views: Optional[List[feast.on_demand_feature_view.OnDemandFeatureView]], metadata: Optional[feast.infra.offline_stores.offline_store.RetrievalMetadata] = None)[source]
Bases:
feast.infra.offline_stores.offline_store.RetrievalJob
- property metadata: Optional[feast.infra.offline_stores.offline_store.RetrievalMetadata]
Return metadata information about retrieval. Should be available even before materializing the dataset itself.
- property on_demand_feature_views: Optional[List[feast.on_demand_feature_view.OnDemandFeatureView]]
- persist(storage: feast.saved_dataset.SavedDatasetStorage)[source]
Run the retrieval and persist the results in the same offline store used for read.
- feast.infra.offline_stores.contrib.postgres_offline_store.postgres.build_point_in_time_query(feature_view_query_contexts: List[dict], left_table_query_string: str, entity_df_event_timestamp_col: str, entity_df_columns: KeysView[str], query_template: str, full_feature_names: bool = False) str [source]
Build point-in-time query between each feature view table and the entity dataframe for PostgreSQL
feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source module
- class feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source.PostgreSQLOptions(name: str, query: Optional[str])[source]
Bases:
object
- class feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source.PostgreSQLSource(name: str, query: str, timestamp_field: Optional[str] = '', created_timestamp_column: Optional[str] = '', field_mapping: Optional[Dict[str, str]] = None, date_partition_column: Optional[str] = '', description: Optional[str] = '', tags: Optional[Dict[str, str]] = None, owner: Optional[str] = '')[source]
Bases:
feast.data_source.DataSource
- static from_proto(data_source: feast.core.DataSource_pb2.DataSource)[source]
Converts data source config in protobuf spec to a DataSource class object.
- Parameters
data_source – A protobuf representation of a DataSource.
- Returns
A DataSource class object.
- Raises
ValueError – The type of DataSource could not be identified.
- get_table_column_names_and_types(config: feast.repo_config.RepoConfig) Iterable[Tuple[str, str]] [source]
Returns the list of column names and raw column types.
- Parameters
config – Configuration object used to configure a feature store.
- get_table_query_string() str [source]
Returns a string that can directly be used to reference this table in SQL.
- static source_datatype_to_feast_value_type() Callable[[str], feast.value_type.ValueType] [source]
Returns the callable method that returns Feast type given the raw column type.
- to_proto() feast.core.DataSource_pb2.DataSource [source]
Converts a DataSourceProto object to its protobuf representation.
- validate(config: feast.repo_config.RepoConfig)[source]
Validates the underlying data source.
- Parameters
config – Configuration object used to configure a feature store.