René's URL Explorer Experiment


Title: BigQuery: Client.query modifies job_config object · Issue #9727 · googleapis/google-cloud-python · GitHub

Open Graph Title: BigQuery: Client.query modifies job_config object · Issue #9727 · googleapis/google-cloud-python

X Title: BigQuery: Client.query modifies job_config object · Issue #9727 · googleapis/google-cloud-python

Description: Steps to reproduce Create a QueryJobConfig object. Pass the object to the Client.query method. Observe that the configuration object has changed. Code example from google.cloud import bigquery client = bigquery.Client() config = bigquery...

Open Graph Description: Steps to reproduce Create a QueryJobConfig object. Pass the object to the Client.query method. Observe that the configuration object has changed. Code example from google.cloud import bigquery clie...

X Description: Steps to reproduce Create a QueryJobConfig object. Pass the object to the Client.query method. Observe that the configuration object has changed. Code example from google.cloud import bigquery clie...

Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/9727

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BigQuery: Client.query modifies job_config object","articleBody":"#### Steps to reproduce\r\n\r\n  1. Create a `QueryJobConfig` object.\r\n  2. Pass the object to the `Client.query` method.\r\n  3. Observe that the configuration object has changed.\r\n\r\n#### Code example\r\n\r\n```python\r\nfrom google.cloud import bigquery\r\n\r\nclient = bigquery.Client()\r\nconfig = bigquery.QueryJobConfig(dry_run=True)\r\njob = client.query(\r\n    \"\"\"\r\n    SELECT name, SUM(number) AS total_people\r\n    FROM `bigquery-public-data.usa_names.usa_1910_current`\r\n    GROUP BY name\r\n    \"\"\",\r\n    job_config=config\r\n)\r\nprint(job.total_bytes_processed)\r\n\r\nconfig.dry_run = False\r\njob = client.query(\r\n    \"\"\"\r\n    SELECT name, SUM(number) AS total_people\r\n    FROM `bigquery-public-data.usa_names.usa_1910_current`\r\n    GROUP BY name\r\n    \"\"\",\r\n    job_config=config\r\n)\r\njob.result()\r\n```\r\n\r\n#### Stack trace\r\n```\r\n---------------------------------------------------------------------------\r\nBadRequest                                Traceback (most recent call last)\r\n\u003cipython-input-17-97f4f20faa6a\u003e in \u003cmodule\u003e\r\n----\u003e 1 job.result()\r\n\r\n~/miniconda3/envs/scratch/lib/python3.7/site-packages/google/cloud/bigquery/job.py in result(self, timeout, page_size, retry, max_results)\r\n   2937         \"\"\"\r\n   2938         try:\r\n-\u003e 2939             super(QueryJob, self).result(timeout=timeout)\r\n   2940 \r\n   2941             # Return an iterator instead of returning the job.\r\n\r\n~/miniconda3/envs/scratch/lib/python3.7/site-packages/google/cloud/bigquery/job.py in result(self, timeout, retry)\r\n    732             self._begin(retry=retry)\r\n    733         # TODO: modify PollingFuture so it can pass a retry argument to done().\r\n--\u003e 734         return super(_AsyncJob, self).result(timeout=timeout)\r\n    735 \r\n    736     def cancelled(self):\r\n\r\n~/miniconda3/envs/scratch/lib/python3.7/site-packages/google/api_core/future/polling.py in result(self, timeout)\r\n    125             # pylint: disable=raising-bad-type\r\n    126             # Pylint doesn't recognize that this is valid in this case.\r\n--\u003e 127             raise self._exception\r\n    128 \r\n    129         return self._result\r\n\r\nBadRequest: 400 Cannot explicitly modify anonymous table swast-scratch:_def2aa82a75fc33513bfb65968607e1f49148f83.anon561d4b35377f56c5960a4a49be253d3c90c120db\r\n\r\n(job ID: 2692472c-1213-4716-8393-d9c49fd7b678)\r\n\r\n                -----Query Job SQL Follows-----                \r\n\r\n    |    .    |    .    |    .    |    .    |    .    |\r\n   1:\r\n   2:    SELECT name, SUM(number) AS total_people\r\n   3:    FROM `bigquery-public-data.usa_names.usa_1910_current`\r\n   4:    GROUP BY name\r\n   5:    \r\n    |    .    |    .    |    .    |    .    |    .    |\r\n```\r\n\r\nWhen you run a job, the configuration object may be modified. In this example, it sets the destination table. It is unexpected that the original Python object would be modified.\r\n\r\nI propose that the `query` (and other \"job\" methods on client) be updated to make a deep copy of the the `job_config` argument before passing it on to the job constructor.","author":{"url":"https://github.com/tswast","@type":"Person","name":"tswast"},"datePublished":"2019-11-11T19:25:20.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/9727/google-cloud-python/issues/9727"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:39b0249a-a730-0c0b-3a55-de3e0a9f81cc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9FAC:18EF1B:1541903:1D4CD99:6A4EA805
html-safe-nonce087716c13609b03e6a2773264aa6cc4d69938bfdd0283f0aaa94eda160026899
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RkFDOjE4RUYxQjoxNTQxOTAzOjFENENEOTk6NkE0RUE4MDUiLCJ2aXNpdG9yX2lkIjoiNzk2Njc4NDA2ODA0OTA4NjQ2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5c9b1623f4450d711686e9dc717d914aa36ed071609f21d0f8b0379c83b215e3
hovercard-subject-tagissue:521141754
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/9727/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6b9e54398446844943113c66360dce04b8c9a08f48b1e8b3e2a29a6e048d889f/googleapis/google-cloud-python/issues/9727
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6b9e54398446844943113c66360dce04b8c9a08f48b1e8b3e2a29a6e048d889f/googleapis/google-cloud-python/issues/9727
og:image:altSteps to reproduce Create a QueryJobConfig object. Pass the object to the Client.query method. Observe that the configuration object has changed. Code example from google.cloud import bigquery clie...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametswast
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
go-importgithub.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id16316451
octolytics-dimension-repository_nwogoogleapis/google-cloud-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id16316451
octolytics-dimension-repository_network_root_nwogoogleapis/google-cloud-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/google-cloud-python/issues/9727#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F9727
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fgoogle-cloud-python%2Fissues%2F9727
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=googleapis%2Fgoogle-cloud-python
Reloadhttps://github.com/googleapis/google-cloud-python/issues/9727
Reloadhttps://github.com/googleapis/google-cloud-python/issues/9727
Reloadhttps://github.com/googleapis/google-cloud-python/issues/9727
Please reload this pagehttps://github.com/googleapis/google-cloud-python/issues/9727
googleapis https://github.com/googleapis
google-cloud-pythonhttps://github.com/googleapis/google-cloud-python
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Fork 1.7k https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Star 5.3k https://github.com/login?return_to=%2Fgoogleapis%2Fgoogle-cloud-python
Code https://github.com/googleapis/google-cloud-python
Issues 441 https://github.com/googleapis/google-cloud-python/issues
Pull requests 139 https://github.com/googleapis/google-cloud-python/pulls
Discussions https://github.com/googleapis/google-cloud-python/discussions
Actions https://github.com/googleapis/google-cloud-python/actions
Projects https://github.com/googleapis/google-cloud-python/projects
Security and quality 0 https://github.com/googleapis/google-cloud-python/security
Insights https://github.com/googleapis/google-cloud-python/pulse
Code https://github.com/googleapis/google-cloud-python
Issues https://github.com/googleapis/google-cloud-python/issues
Pull requests https://github.com/googleapis/google-cloud-python/pulls
Discussions https://github.com/googleapis/google-cloud-python/discussions
Actions https://github.com/googleapis/google-cloud-python/actions
Projects https://github.com/googleapis/google-cloud-python/projects
Security and quality https://github.com/googleapis/google-cloud-python/security
Insights https://github.com/googleapis/google-cloud-python/pulse
#9735https://github.com/googleapis/google-cloud-python/pull/9735
BigQuery: Client.query modifies job_config objecthttps://github.com/googleapis/google-cloud-python/issues/9727#top
#9735https://github.com/googleapis/google-cloud-python/pull/9735
https://github.com/plamut
api: bigqueryIssues related to the BigQuery API.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22api%3A%20bigquery%22
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22priority%3A%20p1%22
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
https://github.com/tswast
tswasthttps://github.com/tswast
on Nov 11, 2019https://github.com/googleapis/google-cloud-python/issues/9727#issue-521141754
plamuthttps://github.com/plamut
api: bigqueryIssues related to the BigQuery API.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22api%3A%20bigquery%22
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22priority%3A%20p1%22
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.https://github.com/googleapis/google-cloud-python/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.