1+ import warnings
12from typing import Callable , Dict , Iterable , Optional , Tuple
23
34from feast import type_map
45from feast .data_source import DataSource
5- from feast .errors import (
6- DataSourceNoNameException ,
7- DataSourceNotFoundException ,
8- RedshiftCredentialsError ,
9- )
6+ from feast .errors import DataSourceNotFoundException , RedshiftCredentialsError
107from feast .protos .feast .core .DataSource_pb2 import DataSource as DataSourceProto
118from feast .protos .feast .core .SavedDataset_pb2 import (
129 SavedDatasetStorage as SavedDatasetStorageProto ,
1916class RedshiftSource (DataSource ):
2017 def __init__ (
2118 self ,
22- name : Optional [str ] = None ,
2319 event_timestamp_column : Optional [str ] = "" ,
2420 table : Optional [str ] = None ,
2521 schema : Optional [str ] = None ,
2622 created_timestamp_column : Optional [str ] = "" ,
2723 field_mapping : Optional [Dict [str , str ]] = None ,
2824 date_partition_column : Optional [str ] = "" ,
2925 query : Optional [str ] = None ,
26+ name : Optional [str ] = None ,
3027 ):
3128 """
3229 Creates a RedshiftSource object.
3330
3431 Args:
35- name (optional): Name for the source. Defaults to the table_ref if not specified.
3632 event_timestamp_column (optional): Event timestamp column used for point in
3733 time joins of feature values.
3834 table (optional): Redshift table where the features are stored.
@@ -43,6 +39,7 @@ def __init__(
4339 source to column names in a feature table or view.
4440 date_partition_column (optional): Timestamp column used for partitioning.
4541 query (optional): The query to be executed to obtain the features.
42+ name (optional): Name for the source. Defaults to the table_ref if not specified.
4643 """
4744 if table is None and query is None :
4845 raise ValueError ('No "table" argument provided.' )
@@ -51,11 +48,15 @@ def __init__(
5148 if table :
5249 _name = table
5350 else :
54- raise DataSourceNoNameException ()
51+ warnings .warn (
52+ (
53+ "Starting in Feast 0.21, Feast will require either a name for a data source (if using query) or `table`."
54+ ),
55+ DeprecationWarning ,
56+ )
5557
56- # TODO(adchia): figure out what to do if user uses the query to start
5758 super ().__init__ (
58- _name ,
59+ _name if _name else "" ,
5960 event_timestamp_column ,
6061 created_timestamp_column ,
6162 field_mapping ,
0 commit comments