-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.authrelease blockingRequired feature/issue must be fixed prior to next release.Required feature/issue must be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Hi Folks,
I don't see that the credentials I pass into the Spanner Client are being used for the InstanceAdminClient or DatabaseAdminClient instantiations. I'm chasing a downstream bug and will fill in details soon, but from what I see, defaultcredentials are assumed to be used when using those APIs, whereas it should use the provided credentials object.
- OS type and version
CentOS - Python version and virtual environment information
python --version
Python 2.7.9 - google-cloud-python version
pip show google-cloud,pip show google-<service>orpip freeze
gapic-google-cloud-spanner-admin-database-v1==0.15.0
gapic-google-cloud-spanner-admin-instance-v1==0.15.0
gapic-google-cloud-spanner-v1==0.15.0
google-auth==0.8.0
google-auth-httplib2==0.0.2
google-cloud-core==0.23.1
google-cloud-spanner==0.23.1
google-compute-engine==2.3.2
google-gax==0.15.6
googleapis-common-protos==1.5.2
grpc-google-iam-v1==0.11.1
grpcio==1.1.3
- Stacktrace if available
- Steps to reproduce
- Create credentials with a service account. Make sure default credentials will fail.
- Try to interact with an instance.
- Code example
import google.auth.credentials
from google.cloud import spanner
from google.oauth2 import service_account
SPANNER_ADMIN_SCOPE = 'https://www.googleapis.com/auth/spanner.admin'
JSON_KEY='/home/me/keys/mykey.json'
credentials = service_account.Credentials.from_service_account_file(
JSON_KEY)
scopes = [ SPANNER_ADMIN_SCOPE ]
credentials = credentials.with_scopes(scopes)
# credentials = google.auth.credentials.with_scopes_if_required(credentials, scopes)
sc = spanner.Client(project='my-project, credentials=credentials)
i = sc.instance('my-instance', configuration_name='regionally-us-central1')
i.exists()
I checked these sites before filing:
- https://github.com/GoogleCloudPlatform/google-cloud-python/issues
- http://stackoverflow.com/questions/tagged/google-cloud-python
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.authrelease blockingRequired feature/issue must be fixed prior to next release.Required feature/issue must be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.