Skip to content

Commit e782090

Browse files
committed
fix: remove redundant DROP INDEX in MySQL _drop_table_and_index
MySQL DROP TABLE already removes all indexes. The separate DROP INDEX was failing on versioned tables that were created via online_write_batch (which doesn't create the _ek index). Also reuse _drop_table_and_index in _drop_all_version_tables instead of duplicating logic. Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
1 parent 386d01a commit e782090

File tree

1 file changed

+1
-3
lines changed
  • sdk/python/feast/infra/online_stores/mysql_online_store

1 file changed

+1
-3
lines changed

sdk/python/feast/infra/online_stores/mysql_online_store/mysql.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ def teardown(
310310

311311

312312
def _drop_table_and_index(cur: Cursor, table_name: str) -> None:
313-
cur.execute(f"DROP INDEX {table_name}_ek ON {table_name};")
314313
cur.execute(f"DROP TABLE IF EXISTS {table_name}")
315314

316315

@@ -323,8 +322,7 @@ def _drop_all_version_tables(cur: Cursor, project: str, table: FeatureView) -> N
323322
(base, f"^{base}_v[0-9]+$"),
324323
)
325324
for (name,) in cur.fetchall():
326-
cur.execute(f"DROP INDEX IF EXISTS {name}_ek ON {name};")
327-
cur.execute(f"DROP TABLE IF EXISTS {name}")
325+
_drop_table_and_index(cur, name)
328326

329327

330328
def _table_id(project: str, table: FeatureView, enable_versioning: bool = False) -> str:

0 commit comments

Comments
 (0)