14
14
15
15
16
16
import enum
17
+ import warnings
17
18
from abc import ABC , abstractmethod
18
19
from typing import Any , Callable , Dict , Iterable , Optional , Tuple
19
20
@@ -179,14 +180,14 @@ class DataSource(ABC):
179
180
180
181
def __init__ (
181
182
self ,
182
- name : str ,
183
183
event_timestamp_column : Optional [str ] = None ,
184
184
created_timestamp_column : Optional [str ] = None ,
185
185
field_mapping : Optional [Dict [str , str ]] = None ,
186
186
date_partition_column : Optional [str ] = None ,
187
187
description : Optional [str ] = "" ,
188
188
tags : Optional [Dict [str , str ]] = None ,
189
189
owner : Optional [str ] = "" ,
190
+ name : Optional [str ] = None ,
190
191
):
191
192
"""
192
193
Creates a DataSource object.
@@ -205,7 +206,15 @@ def __init__(
205
206
owner (optional): The owner of the data source, typically the email of the primary
206
207
maintainer.
207
208
"""
208
- self .name = name
209
+ if not name :
210
+ warnings .warn (
211
+ (
212
+ "Names for data sources need to be supplied. "
213
+ "Data sources without names will no tbe supported after Feast 0.23."
214
+ ),
215
+ UserWarning ,
216
+ )
217
+ self .name = name or ""
209
218
self .event_timestamp_column = (
210
219
event_timestamp_column if event_timestamp_column else ""
211
220
)
@@ -340,14 +349,14 @@ def __init__(
340
349
owner : Optional [str ] = "" ,
341
350
):
342
351
super ().__init__ (
343
- name ,
344
- event_timestamp_column ,
345
- created_timestamp_column ,
346
- field_mapping ,
347
- date_partition_column ,
352
+ event_timestamp_column = event_timestamp_column ,
353
+ created_timestamp_column = created_timestamp_column ,
354
+ field_mapping = field_mapping ,
355
+ date_partition_column = date_partition_column ,
348
356
description = description ,
349
357
tags = tags ,
350
358
owner = owner ,
359
+ name = name ,
351
360
)
352
361
self .kafka_options = KafkaOptions (
353
362
bootstrap_servers = bootstrap_servers ,
@@ -438,7 +447,7 @@ def __init__(
438
447
owner : Optional [str ] = "" ,
439
448
):
440
449
"""Creates a RequestDataSource object."""
441
- super ().__init__ (name , description = description , tags = tags , owner = owner )
450
+ super ().__init__ (name = name , description = description , tags = tags , owner = owner )
442
451
self .schema = schema
443
452
444
453
def validate (self , config : RepoConfig ):
@@ -536,11 +545,11 @@ def __init__(
536
545
owner : Optional [str ] = "" ,
537
546
):
538
547
super ().__init__ (
539
- name ,
540
- event_timestamp_column ,
541
- created_timestamp_column ,
542
- field_mapping ,
543
- date_partition_column ,
548
+ name = name ,
549
+ event_timestamp_column = event_timestamp_column ,
550
+ created_timestamp_column = created_timestamp_column ,
551
+ field_mapping = field_mapping ,
552
+ date_partition_column = date_partition_column ,
544
553
description = description ,
545
554
tags = tags ,
546
555
owner = owner ,
@@ -620,7 +629,7 @@ def __init__(
620
629
owner (optional): The owner of the data source, typically the email of the primary
621
630
maintainer.
622
631
"""
623
- super ().__init__ (name , description = description , tags = tags , owner = owner )
632
+ super ().__init__ (name = name , description = description , tags = tags , owner = owner )
624
633
self .schema = schema
625
634
self .batch_source = batch_source
626
635
if not self .batch_source :
0 commit comments