Questions tagged [python-bigquery]

27 questions
0
votes
1 answer

How to fix: BigQuery query in Python code

I tried to use variables in a BigQuery query. Syntax error. What could be the problem? I tried string blocks with ''' but with same result. QUERY = ('WITH activity_data AS (' 'SELECT user_pseudo_id, event_timestamp, event_name,' …
Akos
  • 49
  • 2
  • 8
0
votes
1 answer

bigquery storage api got hang at create read session

I can use the BigQuery Storage API to read the sample public dataset. But when I created my own dataset, it got hand at create read session: client.create_read_session. The problem still persists even I granted the public read access to the…
0
votes
1 answer

While writing query for bigQuery how to write table name and column name using variables instead of hard coding

In the below mentioned query projectname-dataset-tableName is hardcoded in the query query = """ SELECT city from bigquery-public-data.openaq.global_air_quality WHERE country = 'IN' """ How to write the same in more dynamic way? The fulltableid…
0
votes
1 answer

Moving bigquery data to Redshift

I'm in need to move my bigquery table to redshift. Currently I have a python job that is fetching data from redshift, and it is incremental loading my data on the redshift. This python job is reading bigquery data, creating a csv file in the server,…
Subhamoy
  • 1
  • 1
  • 2
0
votes
1 answer

Insert into table with record column which is repeated (screen in question)

I have table in bigquery with struct And problem with iserting data to test record I try to insert in this way: query = ( """ INSERT INTO test.qwe (name, nick, test) VALUES(@name, @nick, @test) """ ) hitTimeStamp =…
0
votes
1 answer

AttributeError: 'Client' object has no attribute 'query'

I try to implement bigquery in python 2.7 on jupyter notebook. I think my code is correct, but i'm getting the error "AttributeError: 'Client' object has no attribute 'query'" # Create SQL query using natality data after the year 2000 query =…
YY_H
  • 41
  • 1
  • 5
0
votes
1 answer

Dynamic Handing of Bigquery table schema while inserting data into BQ table from variable

I am trying to append data to BQ table using python code which requires dynamic schema handling. Can anyone provide me the link to handle above scenario.
0
votes
2 answers

"Is there any way to get the data between current date to yesterday date via query in Bigquery"

"I am using query for getting data from current date to yesterday date in Bigquery but i am not able to get the yesterday date in BQ" SELECT COUNT (*) FROM `urbn-edw-prod.UrbnProcessingErrors.RetailFeedDimensionError` WHERE errorReason = "Invalid…
0
votes
1 answer

While exporting SELECT statement result to BigQuery only empty table is created

I am trying to export a select statement results to another table as a permanent storage. But, whenenver that new table is created it is schemaless. When I try to query that result table an error is shown: Table project-id.dataset_name.temp_table…
0
votes
1 answer

Bigquery to Avro

I currently run a SQL Query to extract data from a Public BigQuery dataset into a Table, from there I can easily use the Export function to generate a Avro file and save it into GCS. How to generate this file programmatically? I have used BQ API to…
gogasca
  • 9,283
  • 6
  • 80
  • 125
0
votes
2 answers

How to join BigQuery table with ADH(Ads Data Hub) table

I have a BigQuery table 'A' with schema {'UUID': 'String'}. I want to join this table with a ADH(Ads Data Hub) table 'B' having schema {'UUID': 'String', 'USER_ID': 'INT'} on UUID and fetch all user_ids to a new table. I am having trouble in…
-1
votes
3 answers

Bigquery data not getting inserted

I'm using python client library to insert data to big query table. The code is as follows. client = bigquery.Client(project_id) errors = client.insert_rows_json(table=tablename,json_rows=data_to_insert) assert errors == [] There are no errors, but…
bigbounty
  • 16,526
  • 5
  • 37
  • 65
1
2