Skip to content

Commit 35d8c48

Browse files
hao-affirmfranciscojavierarceo
authored andcommitted
fix: Update sql.py (feast-dev#3096)
* Update sql.py Fix a bug that `name = name or obj.name if hasattr(obj, "name") else None` has wrong order sequence. Signed-off-by: hao-affirm <104030690+hao-affirm@users.noreply.github.com> * add test Signed-off-by: hao-affirm <104030690+hao-affirm@users.noreply.github.com> * add test Signed-off-by: hao-affirm <104030690+hao-affirm@users.noreply.github.com> * fix lint Signed-off-by: hao-affirm <104030690+hao-affirm@users.noreply.github.com> Signed-off-by: hao-affirm <104030690+hao-affirm@users.noreply.github.com>
1 parent dc85d5a commit 35d8c48

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

sdk/python/feast/infra/registry/sql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ def _apply_object(
695695
):
696696
self._maybe_init_project_metadata(project)
697697

698-
name = name or obj.name if hasattr(obj, "name") else None
698+
name = name or (obj.name if hasattr(obj, "name") else None)
699699
assert name, f"name needs to be provided for {obj}"
700700

701701
with self.engine.connect() as conn:

sdk/python/tests/unit/test_sql_registry.py

+22
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,25 @@ def test_apply_data_source(sql_registry):
551551
assert registry_batch_source == batch_source
552552

553553
sql_registry.teardown()
554+
555+
556+
@pytest.mark.skipif(
557+
sys.platform == "darwin" and "GITHUB_REF" in os.environ,
558+
reason="does not run on mac github actions",
559+
)
560+
@pytest.mark.parametrize(
561+
"sql_registry",
562+
[
563+
lazy_fixture("mysql_registry"),
564+
lazy_fixture("pg_registry"),
565+
lazy_fixture("sqlite_registry"),
566+
],
567+
)
568+
def test_update_infra(sql_registry):
569+
# Create infra object
570+
project = "project"
571+
infra = sql_registry.get_infra(project=project)
572+
573+
# Should run update infra successfully
574+
sql_registry.update_infra(infra, project)
575+
sql_registry.teardown()

0 commit comments

Comments
 (0)