Skip to content

Commit bca0e1c

Browse files
robhowleyRob Howley
andauthored
chore: Remove dynamodb infraobject (feast-dev#5442)
* remove dynamo infra object proto stuff Signed-off-by: Rob Howley <[email protected]> * remove refs in infra diff Signed-off-by: Rob Howley <[email protected]> * run ruff Signed-off-by: Rob Howley <[email protected]> * update proto imports and tests Signed-off-by: Rob Howley <[email protected]> --------- Signed-off-by: Rob Howley <[email protected]> Co-authored-by: Rob Howley <[email protected]>
1 parent a83dd85 commit bca0e1c

File tree

12 files changed

+42
-304
lines changed

12 files changed

+42
-304
lines changed

protos/feast/core/DynamoDBTable.proto

Lines changed: 0 additions & 31 deletions
This file was deleted.

protos/feast/core/InfraObject.proto

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ option java_outer_classname = "InfraObjectProto";
2222
option go_package = "github.com/feast-dev/feast/go/protos/feast/core";
2323

2424
import "feast/core/DatastoreTable.proto";
25-
import "feast/core/DynamoDBTable.proto";
2625
import "feast/core/SqliteTable.proto";
2726

2827
// Represents a set of infrastructure objects managed by Feast
@@ -38,7 +37,6 @@ message InfraObject {
3837

3938
// The infrastructure object
4039
oneof infra_object {
41-
DynamoDBTable dynamodb_table = 2;
4240
DatastoreTable datastore_table = 3;
4341
SqliteTable sqlite_table = 4;
4442
CustomInfra custom_infra = 100;

sdk/python/feast/diff/infra_diff.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@
44
from feast.diff.property_diff import PropertyDiff, TransitionType
55
from feast.infra.infra_object import (
66
DATASTORE_INFRA_OBJECT_CLASS_TYPE,
7-
DYNAMODB_INFRA_OBJECT_CLASS_TYPE,
87
SQLITE_INFRA_OBJECT_CLASS_TYPE,
98
InfraObject,
109
)
1110
from feast.protos.feast.core.DatastoreTable_pb2 import (
1211
DatastoreTable as DatastoreTableProto,
1312
)
14-
from feast.protos.feast.core.DynamoDBTable_pb2 import (
15-
DynamoDBTable as DynamoDBTableProto,
16-
)
1713
from feast.protos.feast.core.InfraObject_pb2 import Infra as InfraProto
1814
from feast.protos.feast.core.SqliteTable_pb2 import SqliteTable as SqliteTableProto
1915

20-
InfraObjectProto = TypeVar(
21-
"InfraObjectProto", DatastoreTableProto, DynamoDBTableProto, SqliteTableProto
22-
)
16+
InfraObjectProto = TypeVar("InfraObjectProto", DatastoreTableProto, SqliteTableProto)
2317

2418

2519
@dataclass
@@ -110,7 +104,6 @@ def diff_infra_protos(
110104

111105
infra_object_class_types_to_str = {
112106
DATASTORE_INFRA_OBJECT_CLASS_TYPE: "datastore table",
113-
DYNAMODB_INFRA_OBJECT_CLASS_TYPE: "dynamodb table",
114107
SQLITE_INFRA_OBJECT_CLASS_TYPE: "sqlite table",
115108
}
116109

sdk/python/feast/infra/infra_object.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@
2020
from feast.protos.feast.core.DatastoreTable_pb2 import (
2121
DatastoreTable as DatastoreTableProto,
2222
)
23-
from feast.protos.feast.core.DynamoDBTable_pb2 import (
24-
DynamoDBTable as DynamoDBTableProto,
25-
)
2623
from feast.protos.feast.core.InfraObject_pb2 import Infra as InfraProto
2724
from feast.protos.feast.core.InfraObject_pb2 import InfraObject as InfraObjectProto
2825
from feast.protos.feast.core.SqliteTable_pb2 import SqliteTable as SqliteTableProto
2926

3027
DATASTORE_INFRA_OBJECT_CLASS_TYPE = "feast.infra.online_stores.datastore.DatastoreTable"
31-
DYNAMODB_INFRA_OBJECT_CLASS_TYPE = "feast.infra.online_stores.dynamodb.DynamoDBTable"
3228
SQLITE_INFRA_OBJECT_CLASS_TYPE = "feast.infra.online_stores.sqlite.SqliteTable"
3329

3430

@@ -91,8 +87,6 @@ def from_proto(infra_object_proto: Any) -> Any:
9187
"""
9288
if isinstance(infra_object_proto, DatastoreTableProto):
9389
infra_object_class_type = DATASTORE_INFRA_OBJECT_CLASS_TYPE
94-
elif isinstance(infra_object_proto, DynamoDBTableProto):
95-
infra_object_class_type = DYNAMODB_INFRA_OBJECT_CLASS_TYPE
9690
elif isinstance(infra_object_proto, SqliteTableProto):
9791
infra_object_class_type = SQLITE_INFRA_OBJECT_CLASS_TYPE
9892
else:

sdk/python/feast/infra/online_stores/dynamodb.py

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,10 @@
2323
from pydantic import StrictBool, StrictStr
2424

2525
from feast import Entity, FeatureView, utils
26-
from feast.infra.infra_object import DYNAMODB_INFRA_OBJECT_CLASS_TYPE, InfraObject
2726
from feast.infra.online_stores.helpers import compute_entity_id
2827
from feast.infra.online_stores.online_store import OnlineStore
2928
from feast.infra.supported_async_methods import SupportedAsyncMethods
3029
from feast.infra.utils.aws_utils import dynamo_write_items_async
31-
from feast.protos.feast.core.DynamoDBTable_pb2 import (
32-
DynamoDBTable as DynamoDBTableProto,
33-
)
34-
from feast.protos.feast.core.InfraObject_pb2 import InfraObject as InfraObjectProto
3530
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
3631
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
3732
from feast.repo_config import FeastConfigBaseModel, RepoConfig
@@ -717,94 +712,6 @@ def _delete_table_idempotent(
717712
logger.warning(f"Trying to delete table that doesn't exist: {table_name}")
718713

719714

720-
class DynamoDBTable(InfraObject):
721-
"""
722-
A DynamoDB table managed by Feast.
723-
724-
Attributes:
725-
name: The name of the table.
726-
region: The region of the table.
727-
endpoint_url: Local DynamoDB Endpoint Url.
728-
_dynamodb_client: Boto3 DynamoDB client.
729-
_dynamodb_resource: Boto3 DynamoDB resource.
730-
"""
731-
732-
region: str
733-
endpoint_url = None
734-
_dynamodb_client = None
735-
_dynamodb_resource = None
736-
737-
def __init__(self, name: str, region: str, endpoint_url: Optional[str] = None):
738-
super().__init__(name)
739-
self.region = region
740-
self.endpoint_url = endpoint_url
741-
742-
def to_infra_object_proto(self) -> InfraObjectProto:
743-
dynamodb_table_proto = self.to_proto()
744-
return InfraObjectProto(
745-
infra_object_class_type=DYNAMODB_INFRA_OBJECT_CLASS_TYPE,
746-
dynamodb_table=dynamodb_table_proto,
747-
)
748-
749-
def to_proto(self) -> Any:
750-
dynamodb_table_proto = DynamoDBTableProto()
751-
dynamodb_table_proto.name = self.name
752-
dynamodb_table_proto.region = self.region
753-
return dynamodb_table_proto
754-
755-
@staticmethod
756-
def from_infra_object_proto(infra_object_proto: InfraObjectProto) -> Any:
757-
return DynamoDBTable(
758-
name=infra_object_proto.dynamodb_table.name,
759-
region=infra_object_proto.dynamodb_table.region,
760-
)
761-
762-
@staticmethod
763-
def from_proto(dynamodb_table_proto: DynamoDBTableProto) -> Any:
764-
return DynamoDBTable(
765-
name=dynamodb_table_proto.name,
766-
region=dynamodb_table_proto.region,
767-
)
768-
769-
def update(self):
770-
dynamodb_client = self._get_dynamodb_client(self.region, self.endpoint_url)
771-
dynamodb_resource = self._get_dynamodb_resource(self.region, self.endpoint_url)
772-
773-
try:
774-
dynamodb_resource.create_table(
775-
TableName=f"{self.name}",
776-
KeySchema=[{"AttributeName": "entity_id", "KeyType": "HASH"}],
777-
AttributeDefinitions=[
778-
{"AttributeName": "entity_id", "AttributeType": "S"}
779-
],
780-
BillingMode="PAY_PER_REQUEST",
781-
)
782-
except ClientError as ce:
783-
# If the table creation fails with ResourceInUseException,
784-
# it means the table already exists or is being created.
785-
# Otherwise, re-raise the exception
786-
if ce.response["Error"]["Code"] != "ResourceInUseException":
787-
raise
788-
789-
dynamodb_client.get_waiter("table_exists").wait(TableName=f"{self.name}")
790-
791-
def teardown(self):
792-
dynamodb_resource = self._get_dynamodb_resource(self.region, self.endpoint_url)
793-
_delete_table_idempotent(dynamodb_resource, self.name)
794-
795-
def _get_dynamodb_client(self, region: str, endpoint_url: Optional[str] = None):
796-
if self._dynamodb_client is None:
797-
self._dynamodb_client = _initialize_dynamodb_client(region, endpoint_url)
798-
return self._dynamodb_client
799-
800-
def _get_dynamodb_resource(self, region: str, endpoint_url: Optional[str] = None):
801-
if self._dynamodb_resource is None:
802-
self._dynamodb_resource = _initialize_dynamodb_resource(
803-
region, endpoint_url
804-
)
805-
return self._dynamodb_resource
806-
807-
808715
def _to_resource_write_item(config, entity_key, features, timestamp):
809716
entity_id = compute_entity_id(
810717
entity_key,

sdk/python/feast/protos/feast/core/DynamoDBTable_pb2.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

sdk/python/feast/protos/feast/core/DynamoDBTable_pb2.pyi

Lines changed: 0 additions & 50 deletions
This file was deleted.

sdk/python/feast/protos/feast/core/DynamoDBTable_pb2_grpc.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

sdk/python/feast/protos/feast/core/InfraObject_pb2.py

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/python/feast/protos/feast/core/InfraObject_pb2.pyi

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ isort:skip_file
1919
import builtins
2020
import collections.abc
2121
import feast.core.DatastoreTable_pb2
22-
import feast.core.DynamoDBTable_pb2
2322
import feast.core.SqliteTable_pb2
2423
import google.protobuf.descriptor
2524
import google.protobuf.internal.containers
@@ -71,15 +70,12 @@ class InfraObject(google.protobuf.message.Message):
7170
def ClearField(self, field_name: typing_extensions.Literal["field", b"field"]) -> None: ...
7271

7372
INFRA_OBJECT_CLASS_TYPE_FIELD_NUMBER: builtins.int
74-
DYNAMODB_TABLE_FIELD_NUMBER: builtins.int
7573
DATASTORE_TABLE_FIELD_NUMBER: builtins.int
7674
SQLITE_TABLE_FIELD_NUMBER: builtins.int
7775
CUSTOM_INFRA_FIELD_NUMBER: builtins.int
7876
infra_object_class_type: builtins.str
7977
"""Represents the Python class for the infrastructure object"""
8078
@property
81-
def dynamodb_table(self) -> feast.core.DynamoDBTable_pb2.DynamoDBTable: ...
82-
@property
8379
def datastore_table(self) -> feast.core.DatastoreTable_pb2.DatastoreTable: ...
8480
@property
8581
def sqlite_table(self) -> feast.core.SqliteTable_pb2.SqliteTable: ...
@@ -89,13 +85,12 @@ class InfraObject(google.protobuf.message.Message):
8985
self,
9086
*,
9187
infra_object_class_type: builtins.str = ...,
92-
dynamodb_table: feast.core.DynamoDBTable_pb2.DynamoDBTable | None = ...,
9388
datastore_table: feast.core.DatastoreTable_pb2.DatastoreTable | None = ...,
9489
sqlite_table: feast.core.SqliteTable_pb2.SqliteTable | None = ...,
9590
custom_infra: global___InfraObject.CustomInfra | None = ...,
9691
) -> None: ...
97-
def HasField(self, field_name: typing_extensions.Literal["custom_infra", b"custom_infra", "datastore_table", b"datastore_table", "dynamodb_table", b"dynamodb_table", "infra_object", b"infra_object", "sqlite_table", b"sqlite_table"]) -> builtins.bool: ...
98-
def ClearField(self, field_name: typing_extensions.Literal["custom_infra", b"custom_infra", "datastore_table", b"datastore_table", "dynamodb_table", b"dynamodb_table", "infra_object", b"infra_object", "infra_object_class_type", b"infra_object_class_type", "sqlite_table", b"sqlite_table"]) -> None: ...
99-
def WhichOneof(self, oneof_group: typing_extensions.Literal["infra_object", b"infra_object"]) -> typing_extensions.Literal["dynamodb_table", "datastore_table", "sqlite_table", "custom_infra"] | None: ...
92+
def HasField(self, field_name: typing_extensions.Literal["custom_infra", b"custom_infra", "datastore_table", b"datastore_table", "infra_object", b"infra_object", "sqlite_table", b"sqlite_table"]) -> builtins.bool: ...
93+
def ClearField(self, field_name: typing_extensions.Literal["custom_infra", b"custom_infra", "datastore_table", b"datastore_table", "infra_object", b"infra_object", "infra_object_class_type", b"infra_object_class_type", "sqlite_table", b"sqlite_table"]) -> None: ...
94+
def WhichOneof(self, oneof_group: typing_extensions.Literal["infra_object", b"infra_object"]) -> typing_extensions.Literal["datastore_table", "sqlite_table", "custom_infra"] | None: ...
10095

10196
global___InfraObject = InfraObject

0 commit comments

Comments
 (0)