Title: Ability to Create Engine From an Existing BigQuery Client · Issue #464 · googleapis/python-bigquery-sqlalchemy · GitHub
Open Graph Title: Ability to Create Engine From an Existing BigQuery Client · Issue #464 · googleapis/python-bigquery-sqlalchemy
X Title: Ability to Create Engine From an Existing BigQuery Client · Issue #464 · googleapis/python-bigquery-sqlalchemy
Description: In situations where a user already has a google.cloud.bigquery.Client object, it'd be helpful to be able to create an sqlalchemy engine either using that already existing BigQuery client object or the same credentials used by that client...
Open Graph Description: In situations where a user already has a google.cloud.bigquery.Client object, it'd be helpful to be able to create an sqlalchemy engine either using that already existing BigQuery client object or ...
X Description: In situations where a user already has a google.cloud.bigquery.Client object, it'd be helpful to be able to create an sqlalchemy engine either using that already existing BigQuery client object...
Opengraph URL: https://github.com/googleapis/python-bigquery-sqlalchemy/issues/464
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ability to Create Engine From an Existing BigQuery Client","articleBody":"In situations where a user already has a `google.cloud.bigquery.Client` object, it'd be helpful to be able to create an sqlalchemy engine either using that already existing BigQuery client object or the same credentials used by that client. \r\n\r\nI'm poking around and one option would be something like\r\n\r\n```python\r\nbq_client: bigquery.Client\r\nengine = sqlalchemy.engine.create_engine(\r\n 'bigquery://project/?credentials_user_info_json=%s' % bq_client._credentials.to_json())\r\n```\r\nto create a client with the same credentials. This is unfortunately accessing a private `_credentials` attribute on the client. We might look to adding a public interface for this on the client so callers don't need to access `_credentials`.\r\n\r\nI was also looking at something like\r\n\r\n```python\r\nbq_client: bigquery.Client\r\nengine = sqlalchemy.engine.create_engine(\r\n 'bigquery://project', connect_args={'client': bq_client})\r\n```\r\nusing the [connect_args kwarg](https://docs.sqlalchemy.org/en/14/core/engines.html#sqlalchemy.create_engine.params.connect_args)\r\n\r\nThe problem is that the engine will still try to create the client itself even if it will end up being replaced by the one from `connnect_args`. That attempt to create the client by the engine may fail (we're assuming the big query client is created by some machinery that's opaque to the user here.) I'm not seeing a clean way to avoid this.\r\n\r\nAny other suggestions? I'm more than happy to work on this if it seems like a reasonable thing to support!","author":{"url":"https://github.com/waltaskew","@type":"Person","name":"waltaskew"},"datePublished":"2022-06-10T00:23:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/464/python-bigquery-sqlalchemy/issues/464"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dcc93897-9345-6c72-b88e-416c39967f36 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCEE:1A12B5:12CC4CC:1A3E1CF:6A4EA2C6 |
| html-safe-nonce | f6935bf63229e87882f3ba0da3805b8f96e05ee83c1f4c521cb192d735a3bd60 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0VFOjFBMTJCNToxMkNDNENDOjFBM0UxQ0Y6NkE0RUEyQzYiLCJ2aXNpdG9yX2lkIjoiNzMyMzg5ODE2NzU4OTUxMTg3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6811320bdac331f0147e6cc62458e326f6a3f0529d528e5600aab71616c1f1f6 |
| hovercard-subject-tag | issue:1266799742 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-bigquery-sqlalchemy/464/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b2a88568c85729c912afb0a859134f24513f65f3f2b5d504c39aa2bc1fd50fc7/googleapis/python-bigquery-sqlalchemy/issues/464 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b2a88568c85729c912afb0a859134f24513f65f3f2b5d504c39aa2bc1fd50fc7/googleapis/python-bigquery-sqlalchemy/issues/464 |
| og:image:alt | In situations where a user already has a google.cloud.bigquery.Client object, it'd be helpful to be able to create an sqlalchemy engine either using that already existing BigQuery client object or ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | waltaskew |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-bigquery-sqlalchemy git https://github.com/googleapis/python-bigquery-sqlalchemy.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 93616231 |
| octolytics-dimension-repository_nwo | googleapis/python-bigquery-sqlalchemy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 93616231 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-bigquery-sqlalchemy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width