diff --git a/sdk/python/feast/infra/local_sqlite.py b/sdk/python/feast/infra/local_sqlite.py index 14d5d32638..9c35a7b041 100644 --- a/sdk/python/feast/infra/local_sqlite.py +++ b/sdk/python/feast/infra/local_sqlite.py @@ -38,7 +38,7 @@ def update_infra( f"CREATE TABLE IF NOT EXISTS {_table_id(project, table)} (entity_key BLOB, feature_name TEXT, value BLOB, event_ts timestamp, created_ts timestamp, PRIMARY KEY(entity_key, feature_name))" ) conn.execute( - f"CREATE INDEX {_table_id(project, table)}_ek ON {_table_id(project, table)} (entity_key);" + f"CREATE INDEX IF NOT EXISTS {_table_id(project, table)}_ek ON {_table_id(project, table)} (entity_key);" ) for table in tables_to_delete: diff --git a/sdk/python/tests/cli/test_cli_local.py b/sdk/python/tests/cli/test_cli_local.py index ede04bf0b2..72e4b93d7d 100644 --- a/sdk/python/tests/cli/test_cli_local.py +++ b/sdk/python/tests/cli/test_cli_local.py @@ -51,6 +51,10 @@ def test_basic(self) -> None: result = runner.run(["apply", str(repo_path)], cwd=repo_path) assert result.returncode == 0 + # Doing another apply should be a no op, and should not cause errors + result = runner.run(["apply", str(repo_path)], cwd=repo_path) + assert result.returncode == 0 + basic_rw_test(repo_path, "foo") result = runner.run(["teardown", str(repo_path)], cwd=repo_path) diff --git a/sdk/python/tests/cli/test_datastore.py b/sdk/python/tests/cli/test_datastore.py index df615b4ac1..502cc9fec5 100644 --- a/sdk/python/tests/cli/test_datastore.py +++ b/sdk/python/tests/cli/test_datastore.py @@ -58,6 +58,10 @@ def test_basic(self) -> None: result = runner.run(["apply", str(repo_path)], cwd=repo_path) assert result.returncode == 0 + # Doing another apply should be a no op, and should not cause errors + result = runner.run(["apply", str(repo_path)], cwd=repo_path) + assert result.returncode == 0 + basic_rw_test(repo_path, project_name=self._project_id) result = runner.run(["teardown", str(repo_path)], cwd=repo_path)