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, 2019 in GCP by anonymous
• 19,610 points
2,817 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, 2019 by anonymous
• 59,230 points

Related Questions In GCP

0 votes
1 answer
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, 2019 in GCP by Sirajul
• 59,230 points
21,396 views
0 votes
1 answer
0 votes
2 answers
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, 2019 in GCP by Sirajul
• 59,230 points
1,872 views
0 votes
1 answer

Permissions required to update a dataset.

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

answered Nov 15, 2019 in GCP by Sirajul
• 59,230 points
1,756 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, 2019 in GCP by Sirajul
• 59,230 points
1,745 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP