forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add PushSource proto and Python class (feast-dev#2428)
* fix: Add PushSource proto and Python class Signed-off-by: Achal Shah <achals@gmail.com> * tests Signed-off-by: Achal Shah <achals@gmail.com> * remove pdb Signed-off-by: Achal Shah <achals@gmail.com> * cr Signed-off-by: Achal Shah <achals@gmail.com> * cr Signed-off-by: Achal Shah <achals@gmail.com> * cr Signed-off-by: Achal Shah <achals@gmail.com>
- Loading branch information
Showing
3 changed files
with
120 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from feast.data_source import PushSource | ||
from feast.infra.offline_stores.bigquery_source import BigQuerySource | ||
from feast.protos.feast.types.Value_pb2 import ValueType | ||
|
||
|
||
def test_push_no_batch(): | ||
push_source = PushSource( | ||
name="test", schema={"user_id": ValueType.INT64, "ltv": ValueType.INT64} | ||
) | ||
push_source_proto = push_source.to_proto() | ||
assert push_source_proto.push_options is not None | ||
assert not push_source_proto.push_options.HasField("batch_source") | ||
push_source_unproto = PushSource.from_proto(push_source_proto) | ||
|
||
assert push_source.name == push_source_unproto.name | ||
assert push_source.schema == push_source_unproto.schema | ||
assert push_source.batch_source == push_source_unproto.batch_source | ||
|
||
|
||
def test_push_with_batch(): | ||
push_source = PushSource( | ||
name="test", | ||
schema={"user_id": ValueType.INT64, "ltv": ValueType.INT64}, | ||
batch_source=BigQuerySource(table="test.test"), | ||
) | ||
push_source_proto = push_source.to_proto() | ||
assert push_source_proto.push_options is not None | ||
assert push_source_proto.push_options.HasField("batch_source") | ||
|
||
push_source_unproto = PushSource.from_proto(push_source_proto) | ||
|
||
assert push_source.name == push_source_unproto.name | ||
assert push_source.schema == push_source_unproto.schema | ||
assert push_source.batch_source.name == push_source_unproto.batch_source.name |