26,335 questions
-7
votes
1
answer
50
views
BigQuery: How to replace 0 values with NULL in a column? [closed]
I’m trying to clean a BigQuery weather dataset where missing values were entered as 0. My UPDATE query to replace 0 with NULL is throwing an error. How can I correctly convert these zeroes to null ...
-3
votes
0
answers
58
views
SQL subquery issue [closed]
enter image description here (SQL subquery problem)
enter image description here (SQL subquery problem)
See the same result came without using the subquery. So why should I use this complicated ...
0
votes
2
answers
4k
views
Call BigQuery Stored Procedure by naming parameters
I have a BigQuery stored procedure that is defined like this:
CREATE OR REPLACE PROCEDURE proc_name(
param_1 INT64,
param_2 INT64,
param_3 DATE
)
BEGIN
//CODE
END
When I call the ...
1
vote
2
answers
316
views
Is there something like Spark's unionByName in BigQuery?
I'd like to concatenate tables with different schemas, filling unknown values with null.
Simply using UNION ALL of course does not work like this:
WITH
x AS (SELECT 1 AS a, 2 AS b ),
y AS (SELECT ...
0
votes
0
answers
48
views
BigQuery data is not inserted in tables
I'm having random data missing/not showing up in BigQuery issues. I would seemingly write data without issues, but SELECT * would return nothing.
The control panel shows no errors. None of the quotas ...
0
votes
2
answers
165
views
Using multiple CREATE TEMP FUNCTION statements runs fine, fails when executed
I'm trying to create some reusable functions within my SQLX file and I'm finding that if I use CREATE TEMP FUNCTION statements, that it fails when I try to execute the job.
Take this very basic ...
4
votes
2
answers
9k
views
Using ARRAY_TO_STRING with integer array
ARRAY_TO_STRING() works with string arrays but is not supported with integer arrays.
I have a repeated column that contains a list of IDs, I want to export this from a US dataset to an EU dataset. So ...
0
votes
1
answer
83
views
Calculate percent of total per firm and filter firms above 50%
I'm trying to calculate the percentage contribution of each firm to the total amount across all firms.
Database:
google-bigquery
What I need (desired output):
Sum usde_haircut_amt per firm
Compute ...
0
votes
0
answers
70
views
Can I send a JSON object to BigQuery without stringifying it?
I am trying to figure out if there is a way to send a JSON object to a BigQuery table that has a column of type JSON. I know the current practice is to stringify the JSON and send it over which gets ...
0
votes
1
answer
64
views
Vertex AI Agent Builder/Dialogflow CX: Cannot Set ID Key Property for BigQuery Data Store (UI Issue?) - Search Fails for IDs
I'm trying to connect a BigQuery table containing property listings (originally from an Excel/CSV file) to a Vertex AI Agent Builder / Dialogflow CX agent using a Structured Data Store. My goal is to ...
0
votes
0
answers
29
views
How to optimize a BigQuery query that uses multiple JOINs
I’m trying to optimize a BigQuery SQL query that joins several large tables. The query works, but it’s slow and more expensive than expected when running on production-scale datasets.
Below is a ...
1
vote
0
answers
67
views
Databricks always loads built-in BigQuery connector (0.22.2), can’t override with 0.43.x
I am using Databricks Runtime 15.4 (Spark 3.5 / Scala 2.12) on AWS.
My goal is to use the latest Google BigQuery connector because I need the direct write method (BigQuery Storage Write API):
option(&...
-1
votes
0
answers
35
views
[Simba}[BigQuery](310) Storage API Error: DNS resolution failed for service: http:. with verified connection to Google API
When trying to run a query with a large output (600,000 rows of data), I am getting an error :
[Simba}[BigQuery](310) Storage API Error: DNS resolution failed for service: http:.
I am using a proxy ...
0
votes
0
answers
24
views
Unable to fetch Accurate Performance Max (PMAX) YouTube Video Metrics via Google Ads Script / BigQuery Transfer
I’m currently working on a task to fetch and display daily Google ADS Manager (GAM) records—such as Cost, ROAS, and other metrics—within a data analysis application. I’ve successfully retrieved data ...
0
votes
0
answers
34
views
BigQuery TVFs Prevent Optimization, Lead to Higher Billing?
I work on a project in BigQuery using Looker Studio for dashboard visualizations. We recently saw our billing costs and usage skyrocket and are trying to determine the cause. Nothing fundamentally ...
0
votes
1
answer
92
views
Google Pub/Sub push subscription to BigQuery changes value in float data type
I have a BigQuery push subscription in Pub/Sub that for some reason changes the values of the fields with float datatype when pushed to BigQuery.
I tried creating a pull subscription and attached it ...
-1
votes
0
answers
65
views
Connected Sheets with BigQuery
I'm trying to set up connected sheets in Google Sheets, which according to the link below, requires Delegated Access and the access set up in Organization Settings. Is it possible to set these up if I ...
1
vote
2
answers
3k
views
How to persist column descriptions in BigQuery tables
I have created models in my dbt(data build tool) where I have specified column description. In my dbt_project.yml file as shown below
models:
sakila_dbt_project:
# Applies to all files under ...
2
votes
2
answers
2k
views
How do I put a primary key constraint in BigQuery using the Python API?
I am creating a BigQuery table using the Python API. I want to make user_id as the primary key. How do I add this constraint using the Python API?
from google.cloud import bigquery
def create_table():
...
0
votes
2
answers
4k
views
skip dbt model if source table not exist
I am trying to force dbt to skip a model if source table was not found, but I didn't found any resources that could help on such topic, for more detail on the context, I have a folder called sales on ...
Advice
0
votes
1
replies
44
views
Difference between DIV vs / in Bigquery
When i try to do division in bigquery, i saw this.
Initial implementation -> div (x / y) for this i got an error : No matching signature for function DIV Argument types: FLOAT64, FLOAT64 Signature: ...
0
votes
1
answer
71
views
How to reference a CSV column with parentheses and a decimal point in Spark SQL or COALESCE expression?
I’m working on a data ingestion pipeline using Apache Spark (triggered via a Cloud Function on Dataproc).
The input CSV contains column names that include special characters such as parentheses and a ...
2
votes
0
answers
47
views
Why does a DELETE with a JOIN on partitioned columns in BigQuery cost more than dropping specific partitions?
I have a large BigQuery table, big_table, around 5 TB in size.
It is partitioned by the column partition_date, which has about 2000 distinct values.
I also have a smaller table, small_table, which ...
2
votes
1
answer
334
views
How to write a dataframe to BigQuery and overwrite partition instead of the table?
I need to write a polars dataframe into a BigQuery table. The table is partioned by date.
When I need to run a backfilling script I iterate over a date range, get the data from some source (API in ...
1
vote
0
answers
31
views
403 Permission error when creating BigQuery link with GA4 via Admin API (v1alpha)
I’m trying to use the Google Analytics Admin API (v1alpha) to link a GA4 property to BigQuery via the properties.bigQueryLinks.create method.
Here is my code using : https://developers.google.com/...
17
votes
9
answers
30k
views
Make existing bigquery table clustered
I have a quite huge existing partitioned table in bigquery. I want to make the table clustered, at least for the new partition.
From the documentation: https://cloud.google.com/bigquery/docs/creating-...
0
votes
1
answer
642
views
Fuzzball inside Bigquery
How to implement Fuzzball JavaScript as a UDF inside Bigquery? Fuzzball has good amount of dependency libraries which is challenging to include as part of UDF inside Bigquery.
0
votes
0
answers
79
views
How to export BigQuery query results directly to GCS without creating a temporary table (using Java client)
I'm currently aware that I can export a BigQuery query result to Google Cloud Storage (GCS) by first creating a temporary table and then performing an extract table operation on that temp table.
...
0
votes
0
answers
62
views
Wrong REST response for retrieving Column Level Lineage in GCP BigQuery
I have got two BigQuery tables:
bigquery:ssh-test-project-01.SSh_Dataset_03.SSh_BgQ_Src_01 and
bigquery:ssh-test-project-01.SSh_Dataset_03.SSh_BgQ_Dst_BgQ_01.
Using Data Transfer with SQL:
"...
-1
votes
1
answer
922
views
How to join two Polars dataframes with multiple types of conditions? (Equalities and Comparisons)
I'm trying to translate an SQL query into a polars code, and I'm stuck at one line of query, which basically join two tables with certain conditions, here is the sample SQL query that I have been ...
-1
votes
3
answers
98
views
“SELECT list expression references column X which is neither grouped nor aggregated” when using COUNT(*)? [closed]
I'm trying to run a simple SQL query in BigQuery like this:
SELECT usertype, COUNT(*)
FROM `project.dataset.table`;
But I get an error:
SELECT list expression references column usertype which is ...
1
vote
2
answers
192
views
INFORMATION_SCHEMA.TABLE_STORAGE is not enabled for the project [closed]
We're a long time users of the Google BigQuery INFORMATION_SCHEMA.TABLE_STORAGE view, never had problem using it in our automated data processes. But a couple of days ago even the simpliest SELECT ...
1
vote
0
answers
100
views
BigQuery stopped auto-detecting columns for external tables on top of parquet files with custom partitions
Some of our BQ projects create external tables on top of parquet files like this:
CREATE OR REPLACE EXTERNAL TABLE my_dataset my_table
WITH PARTITION COLUMNS (ingestion_date DATE)
OPTIONS (
format ...
10
votes
3
answers
17k
views
How to error Resources exceeded during query execution: Not enough resources for query planning - too many subqueries or query is too complex
How this error occurs "Resources exceeded during query execution: Not enough resources for query planning - too many subqueries or query is too complex" in google BigQuery
1
vote
1
answer
9k
views
Error while using dataframe show method in pyspark
I am trying to read data from BigQuery using pandas and pyspark. I am able to get the data but somehow getting below error while converting it into Spark DataFrame.
py4j.protocol.Py4JJavaError: An ...
0
votes
1
answer
46
views
How to group by geography in Bigquery
I have the following code:
SELECT
h3s.h3id, h3s.geog,
MIN(ST_DISTANCE(`carto-os`.carto.H3_CENTER(htsp.h3id), `carto-os`.carto.H3_CENTER(h3s.h3id)))
OVER (PARTITION BY h3s.h3id)
FROM
...
0
votes
0
answers
48
views
Defining an external table in Dataform
I need to define an external table from Google sheet in Dataform - only a few columns from a given sheet should be used.
Some AI tools are saying that 'range' can be used in OPTIONS, but I guess it's ...
0
votes
0
answers
53
views
Why do my BigQueryInsertJobOperator tasks in Cloud Composer show long queued durations before running?
I’m using Cloud Composer (Airflow) and have two BigQuery operators like this:
run_aggregation = BigQueryInsertJobOperator(
task_id='aggregation_task',
configuration={
"query":...
2
votes
1
answer
9k
views
Container exited with a non-zero exit code 143. Killed by external signal
I'm saving the output of a model as a table in google big query from dataproc cluster using the below code:
Rules.write \
.format("bigquery") \
.option("table","{}....
0
votes
0
answers
65
views
Way to transform a BalanceSheet from QBO inside BigQuery?
I'm using dbt models to transform a QBO Balance Sheet uploaded as a CSV into Bigquery.
Data comes from a fictional company inside QuickBooks test drives from which I export reports in CSV format.
Here'...
1
vote
1
answer
62
views
export data query executes successfully but messages are not pushed to pub/sub topic
I ran this standard query and it executes successfully.
EXPORT DATA
OPTIONS (
uri = 'https://pubsub.googleapis.com/projects/ggdevbigqueryproject/topics/GGTEST',
format = 'JSON',
...
0
votes
1
answer
708
views
BigQuery concat array of bool values
I am trying to run this query and having an issue with the "granted" field:
SELECT
ARRAY_TO_STRING(ARRAY(SELECT permission FROM t.protopayload_auditlog.authorizationInfo), ',') permissions,...
1
vote
2
answers
29k
views
Using an if-else statement in big-query
I need to know how to implement this. I have written a SQL statement in big-query of this format:
with a( select * from tab1),
b as (select * from tab2),
select <field.a>,<field.b> from a ...
0
votes
0
answers
47
views
BigQuery reservation underutilized
I have configured and put into production a BigQuery environment for one of our customers, and we have a question that we cannot answer, even after numerous analyses on our part.
I configured the ...
0
votes
1
answer
99
views
Implementing CASE-WHEN or Aggregations in Materialized Views in BigQuery
I have the below mentioned BigQuery SQL for a View. However, both the tables used in the query are huge in volume and hence I am facing terrible performance issues.
If you'd glance at the query, I am ...
17
votes
7
answers
88k
views
How to run a BigQuery query in Python
This is the query that I have been running in BigQuery that I want to run in my Python script. How would I change this/what do I have to add for it to run in Python?
-- standardSQL
SELECT
Serial,
...
2
votes
2
answers
9k
views
BigQuery - Apache Avro library failed to parse the header with the following error: Invalid data file. Magic does not match
I'm messing with avro file for the first time.
I get a lot of csv files with the encoded data and just made the python treatment of the data that should go to BigQuery. In the end I got the schema ...
1
vote
1
answer
1k
views
BigQuery concat returns null concatenating empty strings
I have a simple table (loaded from a view on top of files) with Countries and Zip codes in BigQuery.
For some strange reason when both Country and Zip code are empty ... concat returns null instead of ...
-1
votes
1
answer
88
views
The analytics_storage value in consent mode is recorded as null
I've installed the Firebase SDK in my iOS app and am using Google Analytics to measure data. The data is exported to BigQuery.
The app incorporates consent mode for consent management. I was suddenly ...
1
vote
1
answer
181
views
Struct column fails to be store in a Big Query table
Description
Hello,
While trying to migrate a part of a code that works with Pandas, I fail to resolve the error below that the code gives me when using a Polars dataframe.
In case of Pandas, I am able ...