Skip to content

Commit

Permalink
chore: Create a registry base class (#2756)
Browse files Browse the repository at this point in the history
* chore: Create a registry base class

Signed-off-by: Achal Shah <[email protected]>

* abstract methods

Signed-off-by: Achal Shah <[email protected]>

* implement missing methods

Signed-off-by: Achal Shah <[email protected]>

* implement missing methods

Signed-off-by: Achal Shah <[email protected]>

* remove dupe

Signed-off-by: Achal Shah <[email protected]>
  • Loading branch information
achals authored Jun 3, 2022
1 parent b3fe39c commit 0d195c4
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
SNOWFLAKE_CI_PASSWORD: ${{ secrets.SNOWFLAKE_CI_PASSWORD }}
SNOWFLAKE_CI_ROLE: ${{ secrets.SNOWFLAKE_CI_ROLE }}
SNOWFLAKE_CI_WAREHOUSE: ${{ secrets.SNOWFLAKE_CI_WAREHOUSE }}
run: pytest -n 8 --cov=./ --cov-report=xml --verbose --color=yes sdk/python/tests --integration --durations=5
run: pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests --integration --durations=5
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
SNOWFLAKE_CI_PASSWORD: ${{ secrets.SNOWFLAKE_CI_PASSWORD }}
SNOWFLAKE_CI_ROLE: ${{ secrets.SNOWFLAKE_CI_ROLE }}
SNOWFLAKE_CI_WAREHOUSE: ${{ secrets.SNOWFLAKE_CI_WAREHOUSE }}
run: FEAST_USAGE=False pytest -n 8 --cov=./ --cov-report=xml --verbose --color=yes sdk/python/tests
run: FEAST_USAGE=False pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ def _plan(
self._registry.refresh()
current_infra_proto = (
self._registry.cached_registry_proto.infra.__deepcopy__()
if self._registry.cached_registry_proto
if hasattr(self._registry, "cached_registry_proto")
and self._registry.cached_registry_proto
else InfraProto()
)
desired_registry_proto = desired_repo_contents.to_registry_proto()
Expand Down
26 changes: 24 additions & 2 deletions sdk/python/feast/infra/registry_stores/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
from feast.protos.feast.core.ValidationProfile_pb2 import (
ValidationReference as ValidationReferenceProto,
)
from feast.registry import Registry
from feast.registry import BaseRegistry
from feast.repo_config import RegistryConfig
from feast.request_feature_view import RequestFeatureView
from feast.saved_dataset import SavedDataset, ValidationReference
from feast.stream_feature_view import StreamFeatureView

metadata = MetaData()

Expand Down Expand Up @@ -121,7 +122,7 @@
)


class SqlRegistry(Registry):
class SqlRegistry(BaseRegistry):
def __init__(
self, registry_config: Optional[RegistryConfig], repo_path: Optional[Path]
):
Expand Down Expand Up @@ -152,6 +153,11 @@ def teardown(self):
def refresh(self):
pass

def list_stream_feature_views(
self, project: str, allow_cache: bool = False
) -> List[StreamFeatureView]:
return []

def apply_entity(self, entity: Entity, project: str, commit: bool = True):
return self._apply_object(entities, "entity_name", entity, "entity_proto")

Expand Down Expand Up @@ -389,6 +395,22 @@ def apply_validation_reference(
"validation_reference_proto",
)

def apply_materialization(
self,
feature_view: FeatureView,
project: str,
start_date: datetime,
end_date: datetime,
commit: bool = True,
):
pass

def delete_validation_reference(self, name: str, project: str, commit: bool = True):
pass

def commit(self):
pass

def _apply_object(
self, table, id_field_name, obj, proto_field_name,
):
Expand Down
Loading

0 comments on commit 0d195c4

Please sign in to comment.