Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/offline_stores/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class BigQueryOfflineStoreConfig(FeastConfigBaseModel):

@field_validator("billing_project_id")
def project_id_exists(cls, v, values, **kwargs):
if v and not values["project_id"]:
if v and not (values.data and values.data["project_id"]):
raise ValueError(
"please specify project_id if billing_project_id is specified"
)
Expand Down
26 changes: 26 additions & 0 deletions sdk/python/tests/unit/infra/offline_stores/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,29 @@ def test_to_arrow_timeout(self, big_query_result):
self.retrieval_job._execute_query.assert_called_once_with(
query=self.query, timeout=30
)


class TestBigQueryRetrievalJobWithBillingProject:
query = "SELECT * FROM bigquery"
client = Mock()

def test_project_id_exists(self):
with pytest.raises(ValueError):
retrieval_job = BigQueryRetrievalJob(
query=self.query,
client=self.client,
config=RepoConfig(
registry="gs://ml-test/repo/registry.db",
project="test",
provider="gcp",
online_store=SqliteOnlineStoreConfig(type="sqlite"),
offline_store=BigQueryOfflineStoreConfig(
type="bigquery",
dataset="feast",
billing_project_id="test-billing-project",
),
),
full_feature_names=True,
on_demand_feature_views=[],
)
retrieval_job.to_df()