Skip to content
Merged
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
Next Next commit
Timestamps
Signed-off-by: Kevin Zhang <kzhang@tecton.ai>
  • Loading branch information
kevjumba committed Apr 5, 2022
commit 3c2f776004098a92af0afa3adcc1d08a8298dbf2
27 changes: 22 additions & 5 deletions sdk/python/feast/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


import warnings
import enum
import warnings
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -170,7 +170,7 @@ class DataSource(ABC):
"""

name: str
event_timestamp_column: str
timestamp_field: str
created_timestamp_column: str
field_mapping: Dict[str, str]
date_partition_column: str
Expand All @@ -181,6 +181,7 @@ class DataSource(ABC):
def __init__(
self,
event_timestamp_column: Optional[str] = None,
timestamp_field: Optional[str] = None,
created_timestamp_column: Optional[str] = None,
field_mapping: Optional[Dict[str, str]] = None,
date_partition_column: Optional[str] = None,
Expand All @@ -195,6 +196,10 @@ def __init__(
name: Name of data source, which should be unique within a project
event_timestamp_column (optional): Event timestamp column used for point in time
joins of feature values.
timestamp_field (optional): Event timestamp column used for point
in time joins of feature values.
event_timestamp_column (optional): (Deprecated) Event timestamp column used for point
in time joins of feature values.
created_timestamp_column (optional): Timestamp column indicating when the row
was created, used for deduplicating rows.
field_mapping (optional): A dictionary mapping of column names in this data
Expand All @@ -215,8 +220,19 @@ def __init__(
UserWarning,
)
self.name = name or ""
self.event_timestamp_column = (
event_timestamp_column if event_timestamp_column else ""
if event_timestamp_column is None and timestamp_field is None:
raise ValueError('No "event_timestamp_column" argument is provided to Datasource')
if not timestamp_field and event_timestamp_column:
warnings.warn(
(
"The argument 'event_timestamp_column' is being deprecated. Please use 'timestamp_field' instead. "
"instead. Feast 0.23 and onwards will not support the argument 'event_timestamp_column' for datasources."
),
DeprecationWarning,
)
self.name = name
self.timestamp_field = (
self.timestamp_field if timestamp_field else (event_timestamp_column if event_timestamp_column else "")
)
self.created_timestamp_column = (
created_timestamp_column if created_timestamp_column else ""
Expand All @@ -241,7 +257,7 @@ def __eq__(self, other):

if (
self.name != other.name
or self.event_timestamp_column != other.event_timestamp_column
or self.timestamp_field != other.timestamp_field
or self.created_timestamp_column != other.created_timestamp_column
or self.field_mapping != other.field_mapping
or self.date_partition_column != other.date_partition_column
Expand Down Expand Up @@ -338,6 +354,7 @@ def __init__(
self,
name: str,
event_timestamp_column: str,
timestamp_field: str,
bootstrap_servers: str,
message_format: StreamFormat,
topic: str,
Expand Down