Tech Blog

Coding, Technology

Schedule Queries in BigQuery

By Jigna Chandarana2 min read
← Back to blog

When you want to run BigQuery queries on a recurring basis, BigQuery provides an amazing feature called Schedule Queries. Schedule queries can include data definition language (DDL) and data manipulation language (DML) statements and can be written in Standard SQL.

It is pretty easy to create and delete scheduled queries. All you need is  BigQuery Data Transfer Service and some permission as mentioned in BigQuery Documentation.

We can store schedule query results in a separate Destination Table and can also append to the same table.

Now Let’s look into how to schedule queries.

First, go to BigQuery UI → write query you want to schedule → click on SCHEDULE → Create new schedule query

And then you’ll be ask for some parameters like,

  • Name for scheduled query
  • Schedule options
    • Repeats –  How frequently you need to run that query eg. everyday, every month etc
    • Start date and run time – When schedule query should start
    • End date – When you want to run schedule query for some predefined period of time, you can set end date
  • Destination 
  • Table name
  • Write preference (overwrite or append)
    • Overwrite – query results will overwrite the data in the table
    • Append – query results will be appended to the data in the table

To modify a scheduled query you can go to Go to BigQuery→ Scheduled queries → click on your schedule query (click on query1) → click on Edit → Write new query in the query editor → SCHEDULE → Update scheduled query.

To Delete/Disable scheduled query, Go to BigQuery → Scheduled queries → Delete/Disable

Note: Schedule Query is only available for projects with billing enabled. It won’t work for SANDBOX account projects.

Reference:

Keep reading

You may be interested in

Browse all articles →
How Angular is Different from AngularJS
September 27, 20227 min read

How Angular is Different from AngularJS

What is Angular? Angular is a popular open-source Typescript framework and free to use. Considered to be a JavaScript-based framework,TypeScript.is its primary programming language. TypeScript is Developed by Microsoft and its superset of JavaScript, which simply means that TypeScript has all the capabilities that JS has and more additional features. Angular is majorly used for […]

By Sachin DevadigaRead More →
Angular constructor vs ngOnInit
September 15, 20223 min read

Angular constructor vs ngOnInit

Overview: If you are new to angular or have been working with it for a while, you will have questions like: Is it necessary to inject dependencies in the constructor and bind data? When should we use ngOnInit ? What is the difference between constructor and OnInit?. So, in this blog we will answer all […]

By Priyanka SRead More →
Angular – Difference between ng-container and ng-template
July 13, 20222 min read

Angular – Difference between ng-container and ng-template

Overview: ng-container and ng-template, both are angular elements which will work like containers with HTML elements, but with different purpose/use cases. Lets see what is the use of ng-container and ng-template below: ng-container: In some cases when you do not want to add an extra HTML element to the DOM , for example like div […]

By Priyanka SRead More →