Skip to content

Commit a935be7

Browse files
committed
chore: Minor refactor
Signed-off-by: Hai Nguyen <quanghai.ng1512@gmail.com>
1 parent 5c82100 commit a935be7

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

  • sdk/python/feast/infra/online_stores/contrib/hbase_online_store

sdk/python/feast/infra/online_stores/contrib/hbase_online_store/hbase.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def online_write_batch(
104104

105105
hbase = HbaseUtils(self._get_conn(config))
106106
project = config.project
107-
table_name = _table_id(project, table)
107+
table_name = self._table_id(project, table)
108108

109109
b = hbase.batch(table_name)
110110
for entity_key, values, timestamp, created_ts in data:
@@ -134,6 +134,7 @@ def online_write_batch(
134134
b.put(row_key, values_dict)
135135
b.send()
136136

137+
progress(len(data))
137138
@log_exceptions_and_usage(online_store="hbase")
138139
def online_read(
139140
self,
@@ -153,7 +154,7 @@ def online_read(
153154
"""
154155
hbase = HbaseUtils(self._get_conn(config))
155156
project = config.project
156-
table_name = _table_id(project, table)
157+
table_name = self._table_id(project, table)
157158

158159
result: List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]] = []
159160

@@ -208,12 +209,12 @@ def update(
208209

209210
# We don't create any special state for the entites in this implementation.
210211
for table in tables_to_keep:
211-
table_name = _table_id(project, table)
212+
table_name = self._table_id(project, table)
212213
if not hbase.check_if_table_exist(table_name):
213214
hbase.create_table_with_default_cf(table_name)
214215

215216
for table in tables_to_delete:
216-
table_name = _table_id(project, table)
217+
table_name = self._table_id(project, table)
217218
hbase.delete_table(table_name)
218219

219220
def teardown(
@@ -233,7 +234,7 @@ def teardown(
233234
project = config.project
234235

235236
for table in tables:
236-
table_name = _table_id(project, table)
237+
table_name = self._table_id(project, table)
237238
hbase.delete_table(table_name)
238239

239240
def _hbase_row_key(
@@ -264,13 +265,12 @@ def _hbase_row_key(
264265
# colocated.
265266
return f"{entity_id}#{feature_view_name}".encode()
266267

268+
def _table_id(self, project: str, table: FeatureView) -> str:
269+
"""
270+
Returns table name given the project_name and the feature_view.
267271
268-
def _table_id(project: str, table: FeatureView) -> str:
269-
"""
270-
Returns table name given the project_name and the feature_view.
271-
272-
Args:
273-
project: Name of the feast project.
274-
table: Feast FeatureView.
275-
"""
276-
return f"{project}_{table.name}"
272+
Args:
273+
project: Name of the feast project.
274+
table: Feast FeatureView.
275+
"""
276+
return f"{project}_{table.name}"

0 commit comments

Comments
 (0)