Skip to content

Tag: google-bigquery

How to add a Jinja function to .sqlfluff config

I’m using the jinja functions run_query and execute. https://docs.getdbt.com/reference/dbt-jinja-functions/run_query But when sqlfluff lint I get the following error: Undefined jinja template variable: ‘run_query’ I’m trying to add it to the .sqlfluff config but there doesn’t see…

Summing field in other rows conditionally

I have table in the form like below: Pilot Leg Duration Takeoff John 1 60 9:00:00 John 2 60 9:00:00 John 3 30 9:00:00 Paul 1 60 12:00:00 Paul 2 30 12:00:00 Paul 3 30 12:00:00 Paul 4 60 12:00:00 And I am trying to figure out is a query to get the following: Pilot Leg Duration Takeoff LegStart John

BigQuery correlated subqueries – transform array to array

I’m trying to join array elements in BigQuery but I am getting the following error message: Correlated subqueries that reference other tables are not supported unless they can be de-correlated, such as by transforming them into an efficient JOIN. In my first table I have something like: field1 | field2 …

How to use two where conditions in SQL?

Following is the query I have written and I need to where conditions. Admin_Level_3_palika is not null Year = ‘2021’ However, the following query is still giving me null values for Admin_Level_3_palika Please help me with how to work with this. Following is an example of my dataset, Epid_ID being …

How to get data for missing weeks in Summarised data

I have two tables stores_data and financial_week as shown below. Stores data is a summarised data across multiple attributes. My task is to generate data for all the weeks present in the second table, if data is missing, the quantity should be listed as 0. Expected Result set is this – I have done cross…