Skip to content

Commit

Permalink
fix: use default project in emulator mode
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Jan 18, 2024
1 parent fd4fba3 commit f4ac54f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions google/cloud/bigtable/data/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import google.auth.credentials
import google.auth._default
from google.api_core import client_options as client_options_lib
from google.cloud.bigtable.client import _DEFAULT_BIGTABLE_EMULATOR_CLIENT
from google.cloud.bigtable.data.row import Row
from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
from google.cloud.bigtable.data.exceptions import FailedQueryShardError
Expand Down Expand Up @@ -132,9 +133,12 @@ def __init__(
Optional[client_options_lib.ClientOptions], client_options
)
self._emulator_host = os.getenv(BIGTABLE_EMULATOR)
if self._emulator_host is not None and credentials is None:
if self._emulator_host is not None:
# use insecure channel if emulator is set
credentials = google.auth.credentials.AnonymousCredentials()
if credentials is None:
credentials = google.auth.credentials.AnonymousCredentials()
if project is None:
project = _DEFAULT_BIGTABLE_EMULATOR_CLIENT
# initialize client
ClientWithProject.__init__(
self,
Expand Down

0 comments on commit f4ac54f

Please sign in to comment.