Skip to content

Commit a17725d

Browse files
authored
feat: Move data source validation entrypoint to offline store (#4197)
* move validate_data_source entrypoint to offline store Signed-off-by: tokoko <togurg14@freeuni.edu.ge> * add validate_data_source to foo provider Signed-off-by: tokoko <togurg14@freeuni.edu.ge> --------- Signed-off-by: tokoko <togurg14@freeuni.edu.ge>
1 parent d91d7e0 commit a17725d

File tree

5 files changed

+50
-2
lines changed

5 files changed

+50
-2
lines changed

sdk/python/feast/infra/offline_stores/offline_store.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,17 @@ def offline_write_batch(
351351
to show progress.
352352
"""
353353
raise NotImplementedError
354+
355+
@staticmethod
356+
def validate_data_source(
357+
config: RepoConfig,
358+
data_source: DataSource,
359+
):
360+
"""
361+
Validates the underlying data source.
362+
363+
Args:
364+
config: Configuration object used to configure a feature store.
365+
data_source: DataSource object that needs to be validated
366+
"""
367+
data_source.validate(config=config)

sdk/python/feast/infra/passthrough_provider.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from feast import importer
99
from feast.batch_feature_view import BatchFeatureView
10+
from feast.data_source import DataSource
1011
from feast.entity import Entity
1112
from feast.feature_logging import FeatureServiceLoggingSource
1213
from feast.feature_service import FeatureService
@@ -383,3 +384,10 @@ def retrieve_feature_service_logs(
383384
start_date=make_tzaware(start_date),
384385
end_date=make_tzaware(end_date),
385386
)
387+
388+
def validate_data_source(
389+
self,
390+
config: RepoConfig,
391+
data_source: DataSource,
392+
):
393+
self.offline_store.validate_data_source(config=config, data_source=data_source)

sdk/python/feast/infra/provider.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from tqdm import tqdm
99

1010
from feast import FeatureService, errors
11+
from feast.data_source import DataSource
1112
from feast.entity import Entity
1213
from feast.feature_view import FeatureView
1314
from feast.importer import import_class
@@ -352,6 +353,21 @@ def retrieve_online_documents(
352353
"""
353354
pass
354355

356+
@abstractmethod
357+
def validate_data_source(
358+
self,
359+
config: RepoConfig,
360+
data_source: DataSource,
361+
):
362+
"""
363+
Validates the underlying data source.
364+
365+
Args:
366+
config: Configuration object used to configure a feature store.
367+
data_source: DataSource object that needs to be validated
368+
"""
369+
pass
370+
355371

356372
def get_provider(config: RepoConfig) -> Provider:
357373
if "." not in config.provider:

sdk/python/feast/repo_operations.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,11 @@ def plan(repo_config: RepoConfig, repo_path: Path, skip_source_validation: bool)
205205
project, registry, repo, store = _prepare_registry_and_repo(repo_config, repo_path)
206206

207207
if not skip_source_validation:
208+
provider = store._get_provider()
208209
data_sources = [t.batch_source for t in repo.feature_views]
209210
# Make sure the data source used by this feature view is supported by Feast
210211
for data_source in data_sources:
211-
data_source.validate(store.config)
212+
provider.validate_data_source(store.config, data_source)
212213

213214
registry_diff, infra_diff, _ = store.plan(repo)
214215
click.echo(registry_diff.to_string())
@@ -282,10 +283,11 @@ def apply_total_with_repo_instance(
282283
skip_source_validation: bool,
283284
):
284285
if not skip_source_validation:
286+
provider = store._get_provider()
285287
data_sources = [t.batch_source for t in repo.feature_views]
286288
# Make sure the data source used by this feature view is supported by Feast
287289
for data_source in data_sources:
288-
data_source.validate(store.config)
290+
provider.validate_data_source(store.config, data_source)
289291

290292
# For each object in the registry, determine whether it should be kept or deleted.
291293
(

sdk/python/tests/foo_provider.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from tqdm import tqdm
88

99
from feast import Entity, FeatureService, FeatureView, RepoConfig
10+
from feast.data_source import DataSource
1011
from feast.infra.offline_stores.offline_store import RetrievalJob
1112
from feast.infra.provider import Provider
1213
from feast.infra.registry.base_registry import BaseRegistry
@@ -130,3 +131,10 @@ def retrieve_online_documents(
130131
]
131132
]:
132133
return []
134+
135+
def validate_data_source(
136+
self,
137+
config: RepoConfig,
138+
data_source: DataSource,
139+
):
140+
pass

0 commit comments

Comments
 (0)