Schedule a query to run every 3 hours in my BigQuery project.

0 votes
How do I schedule a query to run every 3 hours?
Nov 21 in GCP by anonymous
• 6,650 points
27 views

1 answer to this question.

0 votes

 Use the bq query command.

With this method, you will add the flags destination_table (or target_dataset), --schedule and --display_name options to your bq query command to create a scheduled query.

bq query \
--display_name=name \
--destination_table=table \
--schedule=interval

Where:

  • name is the display name for the scheduled query. The display name can be any value that allows you to easily identify the scheduled query if you need to modify it later.

  • table is the destination table for the query results.

    • --target_dataset is an alternative way to name the target dataset for the query results, when used with DDL/DML queries.

    • Use either --destination_table or --target_dataset, but not both.

  • interval, when used with bq query makes a query a recurring scheduled query. A schedule for how often the query should run is required. Examples:

    • --schedule='every 24 hours'

    • --schedule='every 3 hours'

Optional flags:

  • --project_id is your project ID. If --project_id isn't specified, the default project is used.

  • --replace will truncate the destination table and write new results with every run of the scheduled query.

  • --append_table will append results to the destination table.

answered Nov 21 by anonymous
• 40,980 points

Related Questions In GCP

0 votes
1 answer

Is it possible to rename a project in GCP?

Yes, it is possible to rename your ...READ MORE

answered Sep 27 in GCP by Sirajul
• 40,980 points
39 views
0 votes
1 answer

How do I create a BigQuery Dataset using the console?

To create a dataset: Open the BigQuery web ...READ MORE

answered Nov 15 in GCP by anonymous
• 40,980 points
23 views
0 votes
1 answer

Assign access control to a BigQuery Dataset.

You can apply access controls during dataset creation by ...READ MORE

answered Nov 15 in GCP by Sirajul
• 40,980 points
28 views
0 votes
1 answer

Permissions required to update a dataset.

At a minimum, to update dataset properties, ...READ MORE

answered Nov 15 in GCP by Sirajul
• 40,980 points
31 views
0 votes
1 answer

Change default expiration time for a dataset.

You can update a dataset's default table ...READ MORE

answered Nov 15 in GCP by Sirajul
• 40,980 points
28 views
0 votes
1 answer