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: Allow using TableListItem to create a Table #8096

Closed
Assignees
tswast
Labels
api: bigqueryIssues related to the BigQuery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
@max-sixty

Description

@max-sixty

Is your feature request related to a problem? Please describe.

Currently aTableListItem can't be supplied to theTable constructor

In [1]:fromgoogle.cloudimportbigqueryIn [2]:c=bigquery.Client()/usr/local/lib/python3.6/site-packages/google/auth/_default.py:66:UserWarning:YourapplicationhasauthenticatedusingendusercredentialsfromGoogleCloudSDK.Werecommendthatmostserverapplicationsuseserviceaccountsinstead.IfyourapplicationcontinuestouseendusercredentialsfromCloudSDK,youmightreceivea"quota exceeded"or"API not enabled"error.Formoreinformationaboutserviceaccounts,seehttps://cloud.google.com/docs/authentication/warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)/usr/local/lib/python3.6/site-packages/google/auth/_default.py:66:UserWarning:YourapplicationhasauthenticatedusingendusercredentialsfromGoogleCloudSDK.Werecommendthatmostserverapplicationsuseserviceaccountsinstead.IfyourapplicationcontinuestouseendusercredentialsfromCloudSDK,youmightreceivea"quota exceeded"or"API not enabled"error.Formoreinformationaboutserviceaccounts,seehttps://cloud.google.com/docs/authentication/warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)In [3]:c.list_tables('sixty')Out[3]:<google.api_core.page_iterator.HTTPIteratorat0x7fb5ac642e48>In [4]:tables=list(c.list_tables('sixty'))In [5]:tablesOut[5]:[<google.cloud.bigquery.table.TableListItemat0x7fb5ae747048>,<google.cloud.bigquery.table.TableListItemat0x7fb5ae747240>,<google.cloud.bigquery.table.TableListItemat0x7fb5ae7470f0>,<google.cloud.bigquery.table.TableListItemat0x7fb5ae7477f0>,<google.cloud.bigquery.table.TableListItemat0x7fb5ae747e80>,<google.cloud.bigquery.table.TableListItemat0x7fb5ae747c88>,<google.cloud.bigquery.table.TableListItemat0x7fb554282710>]In [6]:c.get_table(tables[0])Out[6]:Table(TableReference(DatasetReference('sixty-capital','sixty'),'equities'))In [7]:bigquery.Table(tables[0])---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)<ipython-input-7-ac46513e6958>in<module>---->1bigquery.Table(tables[0])/usr/local/lib/python3.6/site-packages/google/cloud/bigquery/table.pyin__init__(self,table_ref,schema)365ifisinstance(table_ref,six.string_types):366table_ref=TableReference.from_string(table_ref)-->367self._properties= {"tableReference":table_ref.to_api_repr(),"labels": {}}368# Let the @property do validation.369ifschemaisnotNone:AttributeError:'TableListItem'objecthasnoattribute'to_api_repr'

Describe the solution you'd like

Table can take a reference, a string, aTableListItem, anything that could be a Table - overall either unify the types or make conversions between them implicit

The python BigQuery API has got waaay better, but I still find myself looking at the API docs most times I use it, and it still sometimes feels tethered to the HTTP API (or distant memories of writing Java code :) )

Thank you!

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp