Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix review issues
Signed-off-by: Kevin Zhang <kzhang@tecton.ai>
  • Loading branch information
kevjumba committed Apr 19, 2022
commit f9c374f1ec3526122d42cb55447421b739969693
18 changes: 9 additions & 9 deletions sdk/python/feast/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,15 @@ def __init__(
if args:
warnings.warn(
(
"kafka parameters should be specified as a keyword argument instead of a positional arg."
"Feast 0.23+ will not support positional arguments to construct kafka sources"
"Kafka parameters should be specified as a keyword argument instead of a positional arg."
"Feast 0.23+ will not support positional arguments to construct Kafka sources"
),
DeprecationWarning,
)
if len(args) > len(positional_attributes):
raise ValueError(
f"Only {', '.join(positional_attributes)} are allowed as positional args when defining "
f"kafka sources, for backwards compatibility."
f"Kafka sources, for backwards compatibility."
)
if len(args) >= 1:
_name = args[0]
Expand All @@ -408,7 +408,7 @@ def __init__(
_topic = args[4]

if _message_format is None:
raise ValueError("message format must be specified for kafka source")
raise ValueError("Message format must be specified for Kafka source")

super().__init__(
event_timestamp_column=_event_timestamp_column,
Expand Down Expand Up @@ -528,7 +528,7 @@ def __init__(
if args:
warnings.warn(
(
"requestsource parameters should be specified as a keyword argument instead of a positional arg."
"Requestsource parameters should be specified as a keyword argument instead of a positional arg."
"Feast 0.23+ will not support positional arguments to construct request sources"
),
DeprecationWarning,
Expand Down Expand Up @@ -741,7 +741,7 @@ def __init__(
if args:
warnings.warn(
(
"kinesis parameters should be specified as a keyword argument instead of a positional arg."
"Kinesis parameters should be specified as a keyword argument instead of a positional arg."
"Feast 0.23+ will not support positional arguments to construct kinesis sources"
),
DeprecationWarning,
Expand All @@ -765,7 +765,7 @@ def __init__(
_stream_name = args[5]

if _record_format is None:
raise ValueError("record format must be specified for kinesis source")
raise ValueError("Record format must be specified for kinesis source")

super().__init__(
name=_name,
Expand Down Expand Up @@ -860,7 +860,7 @@ def __init__(
if args:
warnings.warn(
(
"push source parameters should be specified as a keyword argument instead of a positional arg."
"Push source parameters should be specified as a keyword argument instead of a positional arg."
"Feast 0.23+ will not support positional arguments to construct push sources"
),
DeprecationWarning,
Expand All @@ -877,7 +877,7 @@ def __init__(

super().__init__(name=_name, description=description, tags=tags, owner=owner)
if not _batch_source:
raise ValueError(f"batch_source is needed for push source {self.name}")
raise ValueError(f"Batch_source is needed for push source {self.name}")
self.batch_source = _batch_source

def __eq__(self, other):
Expand Down
26 changes: 22 additions & 4 deletions sdk/python/feast/infra/offline_stores/file_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
class FileSource(DataSource):
def __init__(
self,
*,
path: str,
*args,
path: Optional[str] = None,
event_timestamp_column: Optional[str] = "",
file_format: Optional[FileFormat] = None,
created_timestamp_column: Optional[str] = "",
Expand Down Expand Up @@ -59,13 +59,31 @@ def __init__(
>>> from feast import FileSource
>>> file_source = FileSource(path="my_features.parquet", timestamp_field="event_timestamp")
"""
if path is None:
positional_attributes = ["path"]
_path = path
if args:
if args:
warnings.warn(
(
"File Source parameters should be specified as a keyword argument instead of a positional arg."
"Feast 0.23+ will not support positional arguments to construct File sources"
),
DeprecationWarning,
)
if len(args) > len(positional_attributes):
raise ValueError(
f"Only {', '.join(positional_attributes)} are allowed as positional args when defining "
f"File sources, for backwards compatibility."
)
if len(args) >= 1:
_path = args[0]
if _path is None:
raise ValueError(
'No "path" argument provided. Please set "path" to the location of your file source.'
)
self.file_options = FileOptions(
file_format=file_format,
uri=path,
uri=_path,
s3_endpoint_override=s3_endpoint_override,
)

Expand Down