GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BigQuery on python. upload_from_file job not done · Issue #3343 · googleapis/google-cloud-python

BigQuery on python. upload_from_file job not done #3343

New issue
Copy link
New issue
Copy link
Closed
Closed
BigQuery on python. upload_from_file job not done#3343
Copy link
Assignees
dhermes
Labels
api: bigqueryIssues related to the BigQuery API.

Description

@patitonav
patitonav
opened on Apr 28, 2017
Issue body actions

I am running a test to upload a .json file into an bigquery table and i cant get the job done.
Here is my code :

def stream_data2(dataset_name, table_name, json_data):
    bigquery_client = bigquery.Client()
    dataset = bigquery_client.dataset(dataset_name)
    table = dataset.table(table_name)

    # Reload the table to get the schema.
    table.reload()
	
    job = table.upload_from_file(
        json_data, source_format='NEWLINE_DELIMITED_JSON', 
        encoding='UTF-8',
        create_disposition='CREATE_IF_NEEDED',
        write_disposition='WRITE_APPEND')
    pprint.pprint(job)


with open('clarin.json', 'rb') as json_data:
    stream_data2(DATASET_NAME, TABLE_NAME, json_data)

The job ended in fail with this error:

> Errors:
> file-00000000: JSON table encountered too many errors, giving up. Rows: 1; errors: 1. (error code: invalid)
> file-00000000: JSON parsing error in row starting at position 0: . No such field: custom. (error code: invalid)
> 

This has no sense becouse i create the table with a json file with the same structure.

Any suggestion?

Thanks

Activity

  1. dhermes
    added
    api: bigqueryIssues related to the BigQuery API.
    on Apr 28, 2017
  2. dhermes commented on Apr 28, 2017

    @dhermes
    dhermes
    on Apr 28, 2017
    Contributor
    More actions

    @tswast Is JSON even supported as an upload type? (source_format='NEWLINE_DELIMITED_JSON' seems to indicate yes)

  3. tswast commented on Apr 28, 2017

    @tswast
    tswast
    on Apr 28, 2017
    Contributor
    More actions

    Yes, JSON is supported. Keep in mind that it's "Newline Delimited". That means each row not table is a separate JSON object, each separated by a newline.

  4. patitonav commented on Apr 28, 2017

    @patitonav
    patitonav
    on Apr 28, 2017 via email
    Author
    More actions
    Yes, actually in the JSON file there is just one row.
  5. tswast commented on Apr 28, 2017

    @tswast
    tswast
    on Apr 28, 2017
    Contributor
    More actions

    I recommend using the bq command line tool to experiment with the file format & schema. Once you have a file that BigQuery accepts, then you can automate it with this library. https://cloud.google.com/bigquery/bq-command-line-tool

  6. dhermes commented on Apr 28, 2017

    @dhermes
    dhermes
    on Apr 28, 2017
    Contributor
    More actions

    @patitonav I am going to pre-emptively close this, since it seems your issue is with your data formatting and this isn't really an issue with this library.

    Let me know if you'd like to re-open this issue.

    Thanks for the assist @tswast, helpful as always!

  7. dhermes
    closed this as completedon Apr 28, 2017
  8. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  9. parthea
    added a commit that references this issue on Jun 19, 2024

    chore(deps): bump urllib3 from 2.0.7 to 2.2.2 in /.kokoro (#12803)

    bedc2ae
  10. parthea
    added 2 commits that reference this issue on Mar 2, 2026

    samples: add samples from pubsub/cloud-client (#134)

    8c90f22

    Update dependency google-cloud-pubsub to v1.4.2 in Storage and Pub/Su…

    45df1be
  11. parthea
    added a commit that references this issue on Mar 9, 2026

    samples: add cloud client samples from python-docs-samples (#626)

    2b99c9d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

api: bigqueryIssues related to the BigQuery API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.