Skip to content

Commit 58e03d1

Browse files
authored
fix: Bigquery dataset create table disposition (feast-dev#4649)
* fix: adding self to a method which is failing linting in file.py integration tests, added self param to a method that was failing linting and ignoring other issues Signed-off-by: Dan Baron <dan.baron@starlingbank.com> * fix: added create_table_disposition check when creating a dataset when get_historical_features is called Signed-off-by: Dan Baron <dan.baron@starlingbank.com> * fix: ignoring some mypy linting errors caused by expanding a dict into kwargs in the repo_configuration integration tests Signed-off-by: Dan Baron <dan.baron@starlingbank.com> * ignoring typing in auth_permissions_util that would be unreasonable to fix due to length of type required and imports Signed-off-by: Dan Baron <dan.baron@starlingbank.com> * fixing method declaration that has no self parameter Signed-off-by: Dan Baron <dan.baron@starlingbank.com> * made xdist_group methods static Signed-off-by: Dan Baron <dan.baron@starlingbank.com> --------- Signed-off-by: Dan Baron <dan.baron@starlingbank.com>
1 parent 7ac0908 commit 58e03d1

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

sdk/python/feast/infra/offline_stores/bigquery.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def get_historical_features(
242242
dataset_project,
243243
config.offline_store.dataset,
244244
config.offline_store.location,
245+
config.offline_store.table_create_disposition,
245246
)
246247

247248
entity_schema = _get_entity_schema(
@@ -670,6 +671,7 @@ def _get_table_reference_for_new_entity(
670671
dataset_project: str,
671672
dataset_name: str,
672673
dataset_location: Optional[str],
674+
table_create_disposition: str,
673675
) -> str:
674676
"""Gets the table_id for the new entity to be uploaded."""
675677

@@ -679,8 +681,13 @@ def _get_table_reference_for_new_entity(
679681

680682
try:
681683
client.get_dataset(dataset.reference)
682-
except NotFound:
684+
except NotFound as nfe:
683685
# Only create the dataset if it does not exist
686+
if table_create_disposition == "CREATE_NEVER":
687+
raise ValueError(
688+
f"Dataset {dataset_project}.{dataset_name} does not exist "
689+
f"and table_create_disposition is set to {table_create_disposition}."
690+
) from nfe
684691
client.create_dataset(dataset, exists_ok=True)
685692

686693
table_name = offline_utils.get_temp_entity_table_name()

sdk/python/tests/integration/feature_repos/repo_configuration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,9 @@ def construct_test_environment(
575575
}
576576

577577
if not isinstance(offline_creator, RemoteOfflineOidcAuthStoreDataSourceCreator):
578-
environment = Environment(**environment_params)
578+
environment = Environment(**environment_params) # type: ignore
579579
else:
580-
environment = OfflineServerPermissionsEnvironment(**environment_params)
580+
environment = OfflineServerPermissionsEnvironment(**environment_params) # type: ignore
581581
return environment
582582

583583

sdk/python/tests/integration/feature_repos/universal/data_source_creator.py

+1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ def create_logged_features_destination(self) -> LoggingDestination:
6161
def teardown(self):
6262
raise NotImplementedError
6363

64+
@staticmethod
6465
def xdist_groups() -> list[str]:
6566
return []

sdk/python/tests/integration/feature_repos/universal/data_sources/file.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ def __init__(self, project_name: str, *args, **kwargs):
451451
self.server_port: int = 0
452452
self.proc = None
453453

454+
@staticmethod
454455
def xdist_groups() -> list[str]:
455456
return ["keycloak"]
456457

@@ -464,10 +465,10 @@ def setup(self, registry: RegistryConfig):
464465
entity_key_serialization_version=2,
465466
)
466467

467-
repo_path = Path(tempfile.mkdtemp())
468-
with open(repo_path / "feature_store.yaml", "w") as outfile:
468+
repo_base_path = Path(tempfile.mkdtemp())
469+
with open(repo_base_path / "feature_store.yaml", "w") as outfile:
469470
yaml.dump(config.model_dump(by_alias=True), outfile)
470-
repo_path = str(repo_path.resolve())
471+
repo_path = str(repo_base_path.resolve())
471472

472473
include_auth_config(
473474
file_path=f"{repo_path}/feature_store.yaml", auth_config=self.auth_config
@@ -486,7 +487,7 @@ def setup(self, registry: RegistryConfig):
486487
]
487488
self.proc = subprocess.Popen(
488489
cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
489-
)
490+
) # type: ignore
490491

491492
_time_out_sec: int = 60
492493
# Wait for server to start

sdk/python/tests/utils/auth_permissions_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def default_store(
4949

5050
fs = FeatureStore(repo_path=repo_path)
5151

52-
fs.apply(permissions)
52+
fs.apply(permissions) # type: ignore
5353

5454
return fs
5555

0 commit comments

Comments
 (0)