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: The sample to create a BigQuery table is not working #8703

Closed
Assignees
tseaver
Labels
api: bigqueryIssues related to the BigQuery API.status: invalidtype: docsImprovement to the documentation for an API.
@happyhuman

Description

@happyhuman
  1. Specify the API at the beginning of the title (for example, "BigQuery: ...")
    General, Core, and Other are also allowed as types
    This sample to be exact:https://github.com/googleapis/google-cloud-python/blob/7ba0220ff9d0d68241baa863b3152c34dc9f7a1a/bigquery/samples/create_table.py

  2. OS type and version
    MacOS Mojave

  3. Python version and virtual environment information:python --version
    Both 2.7.10 and 3.7

  4. google-cloud- version:pip show google-<service> orpip freeze
    google-cloud-bigquery==1.9.0

Steps to reproduce

  1. set GOOGLE_APPLICATION_CREDENTIALS to my service account key
  2. Make sure "gcloud config list" items are correct.
  3. In the sample code, set table_id to: "{}.datalabeling.cont_eval".format(PROJECT_ID)
  4. Run the sample.

Code example

def create_big_query_table():    schema = [        bigquery.SchemaField("model", "STRING", mode="REQUIRED"),        bigquery.SchemaField("model_version", "INTEGER", mode="REQUIRED"),    ]    client = bigquery.Client()    PROJECT_ID = 'my-gcp-project-id'    table_id = "{}.datalabeling.cont_eval".format(PROJECT_ID)    table = bigquery.Table(table_id, schema=schema)    table = client.create_table(table)  # API request    print(table)

Stack trace

Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/Users/shahins/.virtualenvs/dl2/lib/python2.7/site-packages/google/cloud/bigquery/table.py", line 370, in __init__    self._properties = {"tableReference": table_ref.to_api_repr(), "labels": {}}AttributeError: 'str' object has no attribute 'to_api_repr'

(the line that throws this exception is bigquery.Table(.....))

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.status: invalidtype: docsImprovement to the documentation for an API.

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