question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BigQuery: No errors, but rows sent from python script to BigQuery not appearing.

See original GitHub issue

OS: Ubuntu 14.04.5 LTS Python 2.7.6 and running in c9. google-cloud-python version: google-cloud-bigquery==0.31.0

Hey guys, My code seems to be working fine, I get no errors when I run it (so therefore no traceback). The problem is that the row I’m sending does not appear in my BigQuery table. I’ve tried waiting, and after a day it still does not show. I know the table name is correct, because I create the table with it earlier in my code.

client = bigquery.Client()
        dataset = client.dataset(dataset_id)
        schema = [
        bigquery.SchemaField('product_name', 'STRING', mode='NULLABLE'),
        bigquery.SchemaField('country', 'STRING', mode='NULLABLE'),
        bigquery.SchemaField('date_of_data', 'DATE', mode='NULLABLE'),
        bigquery.SchemaField('platform', 'STRING', mode='NULLABLE'),
        bigquery.SchemaField('active_users', 'INTEGER', mode='NULLABLE')
        ]
        table_name = 'active_users_{}'.format(date_for_bq)
        table = dataset.table(table_name)
        row = 'Hornet','FR','2018-02-10','android_phone','34193'
        client.insert_rows(table, row, selected_fields = schema)

I’ve also tried it with row=['Hornet','FR','2018-02-10','android_phone','34193'] and row=['Hornet,FR,2018-02-10,android_phone,34193'] and gotten the same result. The table exists in my dataset, and it shares the same schema as what you see in my code above. Any idea what I’m doing wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jordan-mscommented, Apr 18, 2018

To anyone reading this: The problem was two things. I was streaming correctly, but when I’d click Preview it wouldn’t show up. The data was still in the table, but it seems to be an issue with BQ’s UI. I could still query that data. The bigger problem was that I couldn’t stream into a freshly created table. You have to wait a minute or so after a table is created to stream into it.

1reaction
TrinhDinhPhuccommented, Nov 15, 2018

@Jordan-Gillard Thank you very much for your information. I thought that my code has errors. But actually, data has imported already. Something’s wrong with Bigquery UI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BigQuery: No errors, but rows sent from python script ... - GitHub
My code seems to be working fine, I get no errors when I run it (so therefore no traceback). The problem is that...
Read more >
Error messages | BigQuery - Google Cloud
This document describes error messages you might encounter when working with BigQuery, including HTTP error codes, job errors, and Google Cloud console ...
Read more >
BadRequest 400 POST No rows present in the request
I stream my data from AppEngine into Bigquery with this code: errors = client.insert_rows(table, bigquery_rows_to_insert) # API request() ...
Read more >
How to Access Your Google BigQuery Data Using Python & R
In this post, we see how to load Google BigQuery data using Python and R, followed by querying the data to get useful...
Read more >
Extracting data from Google BigQuery with Python - Census
In this article, you'll learn how to export data from the Google BigQuery API with Python. Specifically, we'll download a CSV of our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found