@@ -18,7 +18,6 @@ def __init__(
1818 self ,
1919 event_timestamp_column : Optional [str ] = "" ,
2020 table : Optional [str ] = None ,
21- table_ref : Optional [str ] = None ,
2221 created_timestamp_column : Optional [str ] = "" ,
2322 field_mapping : Optional [Dict [str , str ]] = None ,
2423 date_partition_column : Optional [str ] = None ,
@@ -33,14 +32,13 @@ def __init__(
3332
3433 Args:
3534 table (optional): The BigQuery table where features can be found.
36- table_ref (optional): (Deprecated) The BigQuery table where features can be found.
3735 event_timestamp_column: (Deprecated) Event timestamp column used for point in time joins of feature values.
3836 created_timestamp_column (optional): Timestamp column when row was created, used for deduplicating rows.
3937 field_mapping: A dictionary mapping of column names in this data source to feature names in a feature table
4038 or view. Only used for feature columns, not entities or timestamp columns.
4139 date_partition_column (deprecated): Timestamp column used for partitioning.
4240 query (optional): SQL query to execute to generate data for this data source.
43- name (optional): Name for the source. Defaults to the table_ref if not specified.
41+ name (optional): Name for the source. Defaults to the table if not specified.
4442 description (optional): A human-readable description.
4543 tags (optional): A dictionary of key-value pairs to store arbitrary metadata.
4644 owner (optional): The owner of the bigquery source, typically the email of the primary
@@ -51,18 +49,10 @@ def __init__(
5149 >>> from feast import BigQuerySource
5250 >>> my_bigquery_source = BigQuerySource(table="gcp_project:bq_dataset.bq_table")
5351 """
54- if table is None and table_ref is None and query is None :
52+ if table is None and query is None :
5553 raise ValueError ('No "table" or "query" argument provided.' )
56- if not table and table_ref :
57- warnings .warn (
58- (
59- "The argument 'table_ref' is being deprecated. Please use 'table' "
60- "instead. Feast 0.20 and onwards will not support the argument 'table_ref'."
61- ),
62- DeprecationWarning ,
63- )
64- table = table_ref
65- self .bigquery_options = BigQueryOptions (table_ref = table , query = query )
54+
55+ self .bigquery_options = BigQueryOptions (table = table , query = query )
6656
6757 if date_partition_column :
6858 warnings .warn (
@@ -73,13 +63,11 @@ def __init__(
7363 DeprecationWarning ,
7464 )
7565
76- # If no name, use the table_ref as the default name
66+ # If no name, use the table as the default name
7767 _name = name
7868 if not _name :
7969 if table :
8070 _name = table
81- elif table_ref :
82- _name = table_ref
8371 else :
8472 warnings .warn (
8573 (
@@ -111,7 +99,7 @@ def __eq__(self, other):
11199
112100 return (
113101 self .name == other .name
114- and self .bigquery_options .table_ref == other .bigquery_options .table_ref
102+ and self .bigquery_options .table == other .bigquery_options .table
115103 and self .bigquery_options .query == other .bigquery_options .query
116104 and self .timestamp_field == other .timestamp_field
117105 and self .created_timestamp_column == other .created_timestamp_column
@@ -122,8 +110,8 @@ def __eq__(self, other):
122110 )
123111
124112 @property
125- def table_ref (self ):
126- return self .bigquery_options .table_ref
113+ def table (self ):
114+ return self .bigquery_options .table
127115
128116 @property
129117 def query (self ):
@@ -137,7 +125,7 @@ def from_proto(data_source: DataSourceProto):
137125 return BigQuerySource (
138126 name = data_source .name ,
139127 field_mapping = dict (data_source .field_mapping ),
140- table_ref = data_source .bigquery_options .table_ref ,
128+ table = data_source .bigquery_options .table ,
141129 timestamp_field = data_source .timestamp_field ,
142130 created_timestamp_column = data_source .created_timestamp_column ,
143131 query = data_source .bigquery_options .query ,
@@ -169,14 +157,14 @@ def validate(self, config: RepoConfig):
169157
170158 client = bigquery .Client ()
171159 try :
172- client .get_table (self .table_ref )
160+ client .get_table (self .table )
173161 except NotFound :
174- raise DataSourceNotFoundException (self .table_ref )
162+ raise DataSourceNotFoundException (self .table )
175163
176164 def get_table_query_string (self ) -> str :
177165 """Returns a string that can directly be used to reference this table in SQL"""
178- if self .table_ref :
179- return f"`{ self .table_ref } `"
166+ if self .table :
167+ return f"`{ self .table } `"
180168 else :
181169 return f"({ self .query } )"
182170
@@ -190,8 +178,8 @@ def get_table_column_names_and_types(
190178 from google .cloud import bigquery
191179
192180 client = bigquery .Client ()
193- if self .table_ref is not None :
194- schema = client .get_table (self .table_ref ).schema
181+ if self .table is not None :
182+ schema = client .get_table (self .table ).schema
195183 if not isinstance (schema [0 ], bigquery .schema .SchemaField ):
196184 raise TypeError ("Could not parse BigQuery table schema." )
197185 else :
@@ -215,9 +203,9 @@ class BigQueryOptions:
215203 """
216204
217205 def __init__ (
218- self , table_ref : Optional [str ], query : Optional [str ],
206+ self , table : Optional [str ], query : Optional [str ],
219207 ):
220- self ._table_ref = table_ref
208+ self ._table = table
221209 self ._query = query
222210
223211 @property
@@ -235,18 +223,18 @@ def query(self, query):
235223 self ._query = query
236224
237225 @property
238- def table_ref (self ):
226+ def table (self ):
239227 """
240228 Returns the table ref of this BQ table
241229 """
242- return self ._table_ref
230+ return self ._table
243231
244- @table_ref .setter
245- def table_ref (self , table_ref ):
232+ @table .setter
233+ def table (self , table ):
246234 """
247235 Sets the table ref of this BQ table
248236 """
249- self ._table_ref = table_ref
237+ self ._table = table
250238
251239 @classmethod
252240 def from_proto (cls , bigquery_options_proto : DataSourceProto .BigQueryOptions ):
@@ -261,8 +249,7 @@ def from_proto(cls, bigquery_options_proto: DataSourceProto.BigQueryOptions):
261249 """
262250
263251 bigquery_options = cls (
264- table_ref = bigquery_options_proto .table_ref ,
265- query = bigquery_options_proto .query ,
252+ table = bigquery_options_proto .table , query = bigquery_options_proto .query ,
266253 )
267254
268255 return bigquery_options
@@ -276,7 +263,7 @@ def to_proto(self) -> DataSourceProto.BigQueryOptions:
276263 """
277264
278265 bigquery_options_proto = DataSourceProto .BigQueryOptions (
279- table_ref = self .table_ref , query = self .query ,
266+ table = self .table , query = self .query ,
280267 )
281268
282269 return bigquery_options_proto
@@ -287,15 +274,13 @@ class SavedDatasetBigQueryStorage(SavedDatasetStorage):
287274
288275 bigquery_options : BigQueryOptions
289276
290- def __init__ (self , table_ref : str ):
291- self .bigquery_options = BigQueryOptions (table_ref = table_ref , query = None )
277+ def __init__ (self , table : str ):
278+ self .bigquery_options = BigQueryOptions (table = table , query = None )
292279
293280 @staticmethod
294281 def from_proto (storage_proto : SavedDatasetStorageProto ) -> SavedDatasetStorage :
295282 return SavedDatasetBigQueryStorage (
296- table_ref = BigQueryOptions .from_proto (
297- storage_proto .bigquery_storage
298- ).table_ref
283+ table = BigQueryOptions .from_proto (storage_proto .bigquery_storage ).table
299284 )
300285
301286 def to_proto (self ) -> SavedDatasetStorageProto :
@@ -304,4 +289,4 @@ def to_proto(self) -> SavedDatasetStorageProto:
304289 )
305290
306291 def to_data_source (self ) -> DataSource :
307- return BigQuerySource (table_ref = self .bigquery_options .table_ref )
292+ return BigQuerySource (table = self .bigquery_options .table )
0 commit comments