Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BigQuery: Fix Add maximum_bytes_billed option to magics#8179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@HemangChothani
Copy link
Contributor

@HemangChothaniHemangChothani commentedMay 27, 2019
edited
Loading

Fixes#7678

@HemangChothaniHemangChothani requested a review froma teamMay 27, 2019 13:40
@googlebotgooglebot added the cla: yesThis human has signed the Contributor License Agreement. labelMay 27, 2019
sduskis
sduskis previously requested changesMay 28, 2019
Raises:
ValueError: If the parameters are invalid.
"""
returnself._maximum_bytes_billed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Shouldn't this bereturn job_config.maximum_bytes_billed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this part is OK. A potential alternative implementation is to have aself._default_job_config object, but I think that can wait until we have more than one default property to set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think we should just have a default job config that users can set properties on. That way, users can set properties on the default config that we don't have magics arguments for. No need to make properties for each of the job config properties. That approach doesn't scale well, because it would be too much repetitive code to add each job config property separately.

Copy link
ContributorAuthor

@HemangChothaniHemangChothaniMay 29, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@tswast I have created a property for the class Context because i found Set job_config.maximum_bytes_billed = google.cloud.bigquery.magics.context.maximum_bytes_billed line in the description of feature request,So can i remove that property from Context class which is in magic.py file, What and where to set a defalut value or a value of google.cloud.bigquery.magics.context.maximum_bytes_billed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sorry for the "flip flopping"@HemangChothani. Alix convinced me offline that adefault_query_job_config property is the better implementation.

I've added commit30f8326 that implements this.

defmaximum_bytes_billed(self,value):
try:
value=int(value)
self._maximum_bytes_billed=value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do we needself._maximum_bytes_billed? Can't we just usejob_config.maximum_bytes_billed?

Copy link
Contributor

@tswasttswastMay 28, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why isjob_config even in this function?

One way of implementing this feature would be to create aself._default_job_config to hold the default job config (used when constructing the BigQuery client), but that doesn't appear to be what's going on here.

query_job_mock.to_dataframe.return_value=result
withrun_query_patchasrun_query_mock,default_patch:
run_query_mock.return_value=query_job_mock
return_value=ip.run_cell_magic("bigquery","--maximum_bytes_billed=123456789",sql)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you please check to make sure that themaximum_bytes_billed is used?

return_value=ip.run_cell_magic("bigquery","--maximum_bytes_billed=None",sql)

bqstorage_mock.assert_not_called()
query_job_mock.to_dataframe.assert_called_once_with(bqstorage_client=None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you please check to make sure that themaximum_bytes_billed is correct?

@sduskissduskis added the api: bigqueryIssues related to the BigQuery API. labelMay 28, 2019
@tswasttswast self-requested a reviewMay 28, 2019 17:10
Copy link
Contributor

@tswasttswast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

+1 To Solomon's requests for test changes that verify the value is actually set.

defmaximum_bytes_billed(self,value):
try:
value=int(value)
self._maximum_bytes_billed=value
Copy link
Contributor

@tswasttswastMay 28, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why isjob_config even in this function?

One way of implementing this feature would be to create aself._default_job_config to hold the default job config (used when constructing the BigQuery client), but that doesn't appear to be what's going on here.

job_config=bigquery.job.QueryJobConfig()
job_config.maximum_bytes_billed=self._maximum_bytes_billed

exceptException:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This catch block is not needed. Just letint() throw.

try:
value=int(args.maximum_bytes_billed)
job_config.maximum_bytes_billed=value
exceptException:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ditto. Don't catchException. We do need to think about having better error messages in our magics, but I don't think this is the way to do it.

Raises:
ValueError: If the parameters are invalid.
"""
returnself._maximum_bytes_billed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this part is OK. A potential alternative implementation is to have aself._default_job_config object, but I think that can wait until we have more than one default property to set.

@tseavertseaver added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelMay 28, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelMay 28, 2019
@tswasttswastforce-pushed thefeature/Add_maximum_bytes_billed_to_magics branch frome140b64 to30f8326CompareMay 31, 2019 23:56
@tswasttswast added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@tswasttswast requested review fromalixhami,sduskis andtswast and removed request foralixhamiJune 3, 2019 16:29
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@tswasttswast added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@tswasttswast added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@tswasttswast requested a review fromalixhamiJune 3, 2019 17:44
@tswast
Copy link
Contributor

Coverage failure is a weird one. It's not happening locally.

tests/unit/test_magics.py                     410      0      4      1    99%   246->exit

That line is:

assert all(re.match("Query executing: .*s", line) for line in execution_updates)

Maybe it's getting confused by the generator expression? I can try converting that to a plain old for loop.

Maybe that'll fix the coverage issues?
@tswasttswast added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJun 3, 2019
@yoshi-kokoroyoshi-kokoro removed kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelsJun 3, 2019
@tswasttswast dismissedsduskis’sstale reviewJune 3, 2019 19:28

Addressed requested changes in latest commits.

@tswasttswast merged commit0975724 intogoogleapis:masterJun 3, 2019
@tswast
Copy link
Contributor

Thank you@HemangChothani for the contribution. This feature will appear in the next release ofgoogle-cloud-bigquery.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tswasttswasttswast approved these changes

@alixhamialixhamialixhami approved these changes

@sduskissduskisAwaiting requested review from sduskis

Assignees

No one assigned

Labels

api: bigqueryIssues related to the BigQuery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BigQuery: Add maximum_bytes_billed option to magics

7 participants

@HemangChothani@tswast@sduskis@alixhami@tseaver@googlebot@yoshi-kokoro

[8]ページ先頭

©2009-2025 Movatter.jp