Skip to content

Request to use BASIC enum when calling tables.get() in BigQuery #34075#34249

Closed
tamannakakkar93 wants to merge 22 commits intoapache:masterfrom
tamannakakkar93:issue-34075
Closed

Request to use BASIC enum when calling tables.get() in BigQuery #34075#34249
tamannakakkar93 wants to merge 22 commits intoapache:masterfrom
tamannakakkar93:issue-34075

Conversation

@tamannakakkar93
Copy link
Copy Markdown

When calling BigQuery's tables.get method, today, we are retrieving FULL details (which is the default). However, this is expensive and is resulting in customers hitting Quota issues. BigQuery engineering team is open to relaxing this Quota if we retrieve using "BASIC" enum.

https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/get

beam/sdks/python/apache_beam/io/gcp/bigquery.py

Lines 902 to 903 in 9a1e7bf

table = bq.get_table(
table_ref.projectId, table_ref.datasetId, table_ref.tableId)
beam/sdks/python/apache_beam/io/gcp/bigquery_tools.py

Line 565 in 9a1e7bf

response = self.client.tables.Get(request)

@tamannakakkar93 tamannakakkar93 marked this pull request as ready for review March 19, 2025 10:22
@tamannakakkar93 tamannakakkar93 marked this pull request as draft March 19, 2025 10:22
@@ -788,6 +789,7 @@ def get_table(self, project_id, dataset_id, table_id):
"""
request = bigquery.BigqueryTablesGetRequest(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please check

class BigqueryTablesGetRequest(_messages.Message):
. This is defined by Beam.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@liferoad should I replace line 792 with it with view= _messages.enumfield() ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You need define view in BigqueryTablesGetRequest

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@liferoad
Copy link
Copy Markdown
Contributor




self = <apitools.base.protorpclite.messages.EnumField object at 0x7945a7bebfa0> |  
  | value = 'BASIC' |  
  |   |  
  | def validate_element(self, value): |  
  | """Validate single element of field. |  
  |   |  
  | This is different from validate in that it is used on individual |  
  | values of repeated fields. |  
  |   |  
  | Args: |  
  | value: Value to validate. |  
  |   |  
  | Returns: |  
  | The value casted in the expected type. |  
  |   |  
  | Raises: |  
  | ValidationError if value is not expected type. |  
  | """ |  
  | if not isinstance(value, self.type): |  
  |   |  
  | # Authorize int values as float. |  
  | if isinstance(value, six.integer_types) and self.type == float: |  
  | return float(value) |  
  |   |  
  | if value is None: |  
  | if self.required: |  
  | raise ValidationError('Required field is missing') |  
  | else: |  
  | try: |  
  | name = self.name |  
  | except AttributeError: |  
  | raise ValidationError('Expected type %s for %s, ' |  
  | 'found %s (type %s)' % |  
  | (self.type, self.__class__.__name__, |  
  | value, type(value))) |  
  | else: |  
  | >                   raise ValidationError( |  
  | 'Expected type %s for field %s, found %s (type %s)' % |  
  | (self.type, name, value, type(value))) |  
  | E                   apitools.base.protorpclite.messages.ValidationError: Expected type <class 'apache_beam.io.gcp.internal.clients.bigquery.bigquery_v2_messages.BigqueryTablesGetRequest.ViewValueValuesEnum'> for field view, found BASIC (type <class 'str'>) |  
  |  

<br class="Apple-interchange-newline">

Try to use apache_beam.io.gcp.internal.clients.bigquery.bigquery_v2_messages.BigqueryTablesGetRequest.ViewValueValuesEnum not the string.

@github-actions github-actions bot added the yaml label Jun 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 3, 2025

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 3, 2025
@tamannakakkar93
Copy link
Copy Markdown
Author

keep open

@github-actions github-actions bot removed the stale label Aug 5, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 5, 2025

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 5, 2025
@tamannakakkar93
Copy link
Copy Markdown
Author

tamannakakkar93 commented Oct 7, 2025 via email

@github-actions github-actions bot removed the stale label Oct 8, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 8, 2025

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 8, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants