1
+ import warnings
1
2
from typing import Callable , Dict , Iterable , Optional , Tuple
2
3
3
4
from feast import type_map
4
5
from feast .data_source import DataSource
5
- from feast .errors import (
6
- DataSourceNoNameException ,
7
- DataSourceNotFoundException ,
8
- RedshiftCredentialsError ,
9
- )
6
+ from feast .errors import DataSourceNotFoundException , RedshiftCredentialsError
10
7
from feast .protos .feast .core .DataSource_pb2 import DataSource as DataSourceProto
11
8
from feast .protos .feast .core .SavedDataset_pb2 import (
12
9
SavedDatasetStorage as SavedDatasetStorageProto ,
19
16
class RedshiftSource (DataSource ):
20
17
def __init__ (
21
18
self ,
22
- name : Optional [str ] = None ,
23
19
event_timestamp_column : Optional [str ] = "" ,
24
20
table : Optional [str ] = None ,
25
21
schema : Optional [str ] = None ,
26
22
created_timestamp_column : Optional [str ] = "" ,
27
23
field_mapping : Optional [Dict [str , str ]] = None ,
28
24
date_partition_column : Optional [str ] = "" ,
29
25
query : Optional [str ] = None ,
26
+ name : Optional [str ] = None ,
30
27
):
31
28
"""
32
29
Creates a RedshiftSource object.
33
30
34
31
Args:
35
- name (optional): Name for the source. Defaults to the table_ref if not specified.
36
32
event_timestamp_column (optional): Event timestamp column used for point in
37
33
time joins of feature values.
38
34
table (optional): Redshift table where the features are stored.
@@ -43,6 +39,7 @@ def __init__(
43
39
source to column names in a feature table or view.
44
40
date_partition_column (optional): Timestamp column used for partitioning.
45
41
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.
46
43
"""
47
44
if table is None and query is None :
48
45
raise ValueError ('No "table" argument provided.' )
@@ -51,11 +48,15 @@ def __init__(
51
48
if table :
52
49
_name = table
53
50
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
+ )
55
57
56
- # TODO(adchia): figure out what to do if user uses the query to start
57
58
super ().__init__ (
58
- _name ,
59
+ _name if _name else "" ,
59
60
event_timestamp_column ,
60
61
created_timestamp_column ,
61
62
field_mapping ,
0 commit comments