googleapis / python-spanner-sqlalchemy

Apache License 2.0
38 stars 28 forks source link

Does it support impersonate service account? #307

Closed yu-iskw closed 1 year ago

yu-iskw commented 1 year ago

We would like to ingest metadata of Cloud Spanner with python-spanner-sqlalchemy. Specifically, I plan to implement a Spanner source of OpenMetadata. OpenMetadata itself doesn't support impersonate service account yet. However, I would like to implement the feature as well. To do so, I would like to use service account impersonation with python-spanner-slchemy.

yu-iskw commented 1 year ago

@asthamohta I have another question related to the question above. I would like to know if we can use the Spanner client SDK instead of the API wrapper spanner_dbapi. For instance, we can pass our own BigQuery client to the sqlalchemy package. By doing so, we can use impersonate service account. However, I'm not sure we can use impersonate service account with the DB API of Spanner.

https://github.com/googleapis/python-bigquery-sqlalchemy#supplying-your-own-bigquery-client

asthamohta commented 1 year ago

For impersonating the service account, let me check For the latter, currently it isn't possible to do but I can look into providing this feature and get back to you by next week if it would be possible for our team to pick up

asthamohta commented 1 year ago

hi @yu-iskw, after investigating, it is possible to pass the client object directly. I will work on adding the feature and update on this thread.

yu-iskw commented 1 year ago

@asthamohta That sounds great. Passing a client object would be quite helpful to implement the OpenMetadata feature so that we implement authorization to Spanner databases consistently ranging from testing connections to ingesting metadata. If there is anything I can help, please let me know.

yu-iskw commented 1 year ago

@asthamohta Magnificient! Thank you for implementing the feature!