diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py index d0578ff1a..da54b37cb 100644 --- a/google/cloud/bigtable/data/_async/client.py +++ b/google/cloud/bigtable/data/_async/client.py @@ -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 @@ -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,