-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add offline_store config Signed-off-by: Tsotne Tabidze <[email protected]> * Enforce offline_store during feast apply, rename entity_dataset_name to dataset Signed-off-by: Tsotne Tabidze <[email protected]> * Remove ugly getattr since it's unnecessary anymore Signed-off-by: Tsotne Tabidze <[email protected]> * Rename Bigquery to BigQuery Signed-off-by: Tsotne Tabidze <[email protected]>
- Loading branch information
Showing
14 changed files
with
206 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,41 @@ | ||
from typing import List | ||
|
||
from feast.data_source import BigQuerySource, DataSource, FileSource | ||
from feast.errors import FeastOfflineStoreUnsupportedDataSource | ||
from feast.infra.offline_stores.offline_store import OfflineStore | ||
from feast.repo_config import ( | ||
BigQueryOfflineStoreConfig, | ||
FileOfflineStoreConfig, | ||
OfflineStoreConfig, | ||
) | ||
|
||
|
||
def get_offline_store_from_sources(sources: List[DataSource]) -> OfflineStore: | ||
"""Detect which offline store should be used for retrieving historical features""" | ||
|
||
source_types = [type(source) for source in sources] | ||
def get_offline_store_from_config( | ||
offline_store_config: OfflineStoreConfig, | ||
) -> OfflineStore: | ||
"""Get the offline store from offline store config""" | ||
|
||
# Retrieve features from ParquetOfflineStore | ||
if all(source == FileSource for source in source_types): | ||
if isinstance(offline_store_config, FileOfflineStoreConfig): | ||
from feast.infra.offline_stores.file import FileOfflineStore | ||
|
||
return FileOfflineStore() | ||
|
||
# Retrieve features from BigQueryOfflineStore | ||
if all(source == BigQuerySource for source in source_types): | ||
elif isinstance(offline_store_config, BigQueryOfflineStoreConfig): | ||
from feast.infra.offline_stores.bigquery import BigQueryOfflineStore | ||
|
||
return BigQueryOfflineStore() | ||
|
||
# Could not map inputs to an OfflineStore implementation | ||
raise NotImplementedError( | ||
"Unsupported combination of feature view input source types. Please ensure that all source types are " | ||
"consistent and available in the same offline store." | ||
raise ValueError(f"Unsupported offline store config '{offline_store_config}'") | ||
|
||
|
||
def assert_offline_store_supports_data_source( | ||
offline_store_config: OfflineStoreConfig, data_source: DataSource | ||
): | ||
if ( | ||
isinstance(offline_store_config, FileOfflineStoreConfig) | ||
and isinstance(data_source, FileSource) | ||
) or ( | ||
isinstance(offline_store_config, BigQueryOfflineStoreConfig) | ||
and isinstance(data_source, BigQuerySource) | ||
): | ||
return | ||
raise FeastOfflineStoreUnsupportedDataSource( | ||
offline_store_config.type, data_source.__class__.__name__ | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.