Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Apply billing project when infer schema #3417

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
4 changes: 2 additions & 2 deletions sdk/python/feast/infra/offline_stores/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
from feast.infra.registry.base_registry import BaseRegistry
from feast.on_demand_feature_view import OnDemandFeatureView
from feast.repo_config import FeastConfigBaseModel, RepoConfig
from feast.saved_dataset import SavedDatasetStorage
from feast.usage import get_user_agent, log_exceptions_and_usage

from ...saved_dataset import SavedDatasetStorage
from ...usage import get_user_agent, log_exceptions_and_usage
from .bigquery_source import (
BigQueryLoggingDestination,
BigQuerySource,
Expand Down
17 changes: 16 additions & 1 deletion sdk/python/feast/infra/offline_stores/bigquery_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@
)
from feast.repo_config import RepoConfig
from feast.saved_dataset import SavedDatasetStorage
from feast.usage import get_user_agent
from feast.value_type import ValueType

try:
from google.api_core import client_info as http_client_info
except ImportError as e:
from feast.errors import FeastExtrasDependencyImportError

raise FeastExtrasDependencyImportError("gcp", str(e))


@typechecked
class BigQuerySource(DataSource):
Expand Down Expand Up @@ -159,7 +167,14 @@ def get_table_column_names_and_types(
) -> Iterable[Tuple[str, str]]:
from google.cloud import bigquery

client = bigquery.Client()
project_id = (
config.offline_store.billing_project_id or config.offline_store.project_id
)
client = bigquery.Client(
project=project_id,
location=config.offline_store.location,
client_info=http_client_info.ClientInfo(user_agent=get_user_agent()),
)
if self.table:
schema = client.get_table(self.table).schema
if not isinstance(schema[0], bigquery.schema.SchemaField):
Expand Down