Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Record leaf types are not supported. #3695

Closed
binhnq94 opened this issue Jul 28, 2017 · 4 comments
Closed

Error: Record leaf types are not supported. #3695

binhnq94 opened this issue Jul 28, 2017 · 4 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. status: duplicate Duplicate.

Comments

@binhnq94
Copy link

binhnq94 commented Jul 28, 2017

  1. OS version: ubuntu 17.04
  2. Python version: Python 3.6.1
  3. Lib version:
google-auth (1.0.1)
google-auth-httplib2 (0.0.2)
google-cloud-bigquery (0.25.0)
google-cloud-core (0.25.0)
googleapis-common-protos (1.5.2)
  1. After i call table.insert_data, result object is :
[{'index': 0, 'errors': [{'reason': 'invalid', 'location': '', 'debugInfo': 'generic::failed_precondition: Record leaf types are not supported.optional .Msg_0_CLOUD_QUERY_TABLE.Msg_1_CLOUD_QUERY_TABLE_user user = 2;\n', 'message': 'Record leaf types are not supported.optional .Msg_0_CLOUD_QUERY_TABLE.Msg_1_CLOUD_QUERY_TABLE_user user = 2;\n'}]}]
  1. Code example:
  • table's schema:
schema = [bigquery.SchemaField('timestamp', 'TIMESTAMP', mode='REQUIRED'),
              bigquery.SchemaField('user', 'RECORD', fields=[
                  bigquery.SchemaField('id', 'INTEGER'),
                  bigquery.SchemaField('name', 'STRING'),
                  bigquery.SchemaField('mail', 'STRING'),
                  bigquery.SchemaField('phone', 'STRING'),
              ]),
              bigquery.SchemaField('action', 'STRING', mode='REQUIRED'),
              bigquery.SchemaField('project', 'STRING', mode='REQUIRED')]
  • data test:
data = (
            time.time(),
            12345,
            "user name",
            "mail",
            "phone",
            "action",
            "project"

        )

r = table.insert_data([tuple(data)])
@dhermes
Copy link
Contributor

dhermes commented Jul 28, 2017

@TechBK The issue is that "Record leaf types are not supported." (see the error message.)

@tswast I am not quite sure what that means?

@tswast
Copy link
Contributor

tswast commented Jul 28, 2017

I think this is a duplicate of #2951.

I think we need some examples of inserting nested records in the docs, but for now you can look at the system test that was added for how to do it. https://github.com/GoogleCloudPlatform/google-cloud-python/pull/3171/files

@tswast tswast marked this as a duplicate of #2951 Jul 28, 2017
@tswast tswast closed this as completed Jul 28, 2017
@dhermes
Copy link
Contributor

dhermes commented Jul 28, 2017

Thanks a lot Tim!

@binhnq94 binhnq94 changed the title Fail table.insert_data Error: Record leaf types are not supported. Jul 29, 2017
@binhnq94
Copy link
Author

But, i see document of insert_data function at #L750:

:param rows: Row data to be inserted. Each tuple should contain data
                     for each schema field on the current table and in the
                     same order as the schema fields.

I think this document is not clear

@dhermes dhermes added api: bigquery Issues related to the BigQuery API. status: duplicate Duplicate. labels Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. status: duplicate Duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants