1+ import warnings
12from typing import Callable , Dict , Iterable , Optional , Tuple
23
34from pyarrow ._fs import FileSystem
@@ -61,6 +62,7 @@ def __init__(
6162 self .file_options = FileOptions (
6263 file_format = file_format ,
6364 file_url = path ,
65+ uri = path ,
6466 s3_endpoint_override = s3_endpoint_override ,
6567 )
6668
@@ -85,7 +87,6 @@ def __eq__(self, other):
8587
8688 return (
8789 self .name == other .name
88- and self .file_options .file_url == other .file_options .file_url
8990 and self .file_options .file_format == other .file_options .file_format
9091 and self .event_timestamp_column == other .event_timestamp_column
9192 and self .created_timestamp_column == other .created_timestamp_column
@@ -102,15 +103,15 @@ def path(self):
102103 """
103104 Returns the path of this file data source.
104105 """
105- return self .file_options .file_url
106+ return self .file_options .uri
106107
107108 @staticmethod
108109 def from_proto (data_source : DataSourceProto ):
109110 return FileSource (
110111 name = data_source .name ,
111112 field_mapping = dict (data_source .field_mapping ),
112113 file_format = FileFormat .from_proto (data_source .file_options .file_format ),
113- path = data_source .file_options .file_url ,
114+ path = data_source .file_options .uri ,
114115 event_timestamp_column = data_source .event_timestamp_column ,
115116 created_timestamp_column = data_source .created_timestamp_column ,
116117 date_partition_column = data_source .date_partition_column ,
@@ -182,17 +183,28 @@ def __init__(
182183 file_format : Optional [FileFormat ],
183184 file_url : Optional [str ],
184185 s3_endpoint_override : Optional [str ],
186+ uri : Optional [str ],
185187 ):
186188 """
187189 FileOptions initialization method
188190
189191 Args:
190192 file_format (FileFormat, optional): file source format eg. parquet
191- file_url (str, optional): file source url eg. s3:// or local file
192- s3_endpoint_override (str, optional): custom s3 endpoint (used only with s3 file_url)
193+ file_url (str, optional): [DEPRECATED] file source url eg. s3:// or local file
194+ s3_endpoint_override (str, optional): custom s3 endpoint (used only with s3 uri)
195+ uri (str, optional): file source url eg. s3:// or local file
196+
193197 """
194198 self ._file_format = file_format
195- self ._file_url = file_url
199+ if file_url :
200+ warnings .warn (
201+ (
202+ "The option to pass a file_url parameter to FileOptions is being deprecated. "
203+ "Please pass the file url to the uri parameter instead. The parameter will be deprecated in Feast 0.23"
204+ ),
205+ DeprecationWarning ,
206+ )
207+ self ._uri = uri or file_url
196208 self ._s3_endpoint_override = s3_endpoint_override
197209
198210 @property
@@ -223,6 +235,20 @@ def file_url(self, file_url):
223235 """
224236 self ._file_url = file_url
225237
238+ @property
239+ def uri (self ):
240+ """
241+ Returns the file url of this file
242+ """
243+ return self ._uri
244+
245+ @uri .setter
246+ def uri (self , uri ):
247+ """
248+ Sets the file url of this file
249+ """
250+ self ._uri = uri
251+
226252 @property
227253 def s3_endpoint_override (self ):
228254 """
@@ -250,7 +276,8 @@ def from_proto(cls, file_options_proto: DataSourceProto.FileOptions):
250276 """
251277 file_options = cls (
252278 file_format = FileFormat .from_proto (file_options_proto .file_format ),
253- file_url = file_options_proto .file_url ,
279+ file_url = "" ,
280+ uri = file_options_proto .uri ,
254281 s3_endpoint_override = file_options_proto .s3_endpoint_override ,
255282 )
256283 return file_options
@@ -262,12 +289,11 @@ def to_proto(self) -> DataSourceProto.FileOptions:
262289 Returns:
263290 FileOptionsProto protobuf
264291 """
265-
266292 file_options_proto = DataSourceProto .FileOptions (
267293 file_format = (
268294 None if self .file_format is None else self .file_format .to_proto ()
269295 ),
270- file_url = self .file_url ,
296+ uri = self .uri ,
271297 s3_endpoint_override = self .s3_endpoint_override ,
272298 )
273299
@@ -286,16 +312,17 @@ def __init__(
286312 s3_endpoint_override : Optional [str ] = None ,
287313 ):
288314 self .file_options = FileOptions (
289- file_url = path ,
290315 file_format = file_format ,
316+ file_url = "" ,
291317 s3_endpoint_override = s3_endpoint_override ,
318+ uri = path ,
292319 )
293320
294321 @staticmethod
295322 def from_proto (storage_proto : SavedDatasetStorageProto ) -> SavedDatasetStorage :
296323 file_options = FileOptions .from_proto (storage_proto .file_storage )
297324 return SavedDatasetFileStorage (
298- path = file_options .file_url ,
325+ path = file_options .uri ,
299326 file_format = file_options .file_format ,
300327 s3_endpoint_override = file_options .s3_endpoint_override ,
301328 )
@@ -305,7 +332,7 @@ def to_proto(self) -> SavedDatasetStorageProto:
305332
306333 def to_data_source (self ) -> DataSource :
307334 return FileSource (
308- path = self .file_options .file_url ,
335+ path = self .file_options .uri ,
309336 file_format = self .file_options .file_format ,
310337 s3_endpoint_override = self .file_options .s3_endpoint_override ,
311338 )
0 commit comments