Content-Length: 291094 | pFad | https://github.com/googleapis/google-cloud-python/issues/9203

43 BigQuery: "Failed to parse JSON: No active field found" when using load_table_from_json() · Issue #9203 · googleapis/google-cloud-python · GitHub
Skip to content

BigQuery: "Failed to parse JSON: No active field found" when using load_table_from_json() #9203

Closed
@jacques-

Description

@jacques-

On Mac (Python 3.7.4 & google-cloud-bigquery==1.19.0) I'm using the following code:

from google.cloud import bigquery

test_ndjson = '{"name": "bob"}'
client = bigquery.Client()
table_ref = client.dataset('my_ds').table('test')
job_config = bigquery.LoadJobConfig()
job_config.write_disposition = bigquery.WriteDisposition.WRITE_TRUNCATE
job_config.source_format = bigquery.SourceFormat.NEWLINE_DELIMITED_JSON
job_config.autodetect = True
job = client.load_table_from_json(test_ndjson, table_ref, job_config=job_config)
job.result()  # Waits for table load to complete.

I get:

google.api_core.exceptions.BadRequest: 400 Error while reading data, error message: Failed to parse JSON: No active field found.; ParsedString returned false

When I do exactly the same thing using the bq command it works as expected:

echo '{"name": "bob"}' > data.json
bq load --apilog '' --source_format=NEWLINE_DELIMITED_JSON --autodetect=True myproject\:my_ds.test ./data.json

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.type: 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









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/googleapis/google-cloud-python/issues/9203

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy