Scheduled Queries


Scheduled Queries


Scheduled Queries jobs enable you to run saved queries on a given schedule.

With the CData Connect Cloud Scheduled Queries feature, you can save queries that you create in the Data Explorer as scheduled queries, or queries that run at regular intervals. You can use the Query Builder to build the query or the SQL Editor to write a SQL query manually. You then save the query as a scheduled query. Next, you choose the schedule for running the query. Finally, you select the target destination for saving the query. CData Connect Cloud supports the following destinations for Scheduled Queries:

  • BigQuery
  • Databricks
  • PostgreSQL
  • Redshift
  • Smartsheet
  • Snowflake

While you create scheduled queries in the Data Explorer, you manage them in the Jobs page.

The Jobs page contains a list of scheduled query jobs to run.

For each job, the Jobs page displays the scheduled query name and target destination, the last time the job was run, the date and time of the next run, and the status of the job. You can select multiple jobs to run immediately by selecting the jobs and clicking Run at the top of the page. You can also delete multiple jobs by selecting them and clicking Delete at the top of the page.

The Jobs page also allows you to disable a particular scheduled query job, if you want to pause the scheduled job but not delete it. Use the toggle switch in the Status column to enable or disable a job. You cannot run a job manually as long as it is disabled.

Configuring Scheduled Queries

Before you can use the Schedule Queries feature, you need to add a destination connection, schema, and table for your scheduled query. The destination table contains the results of your scheduled query. If you haven’t already done so, add your destination connection in the Add Connection page. Note that the connection type for the destination must be one of the following: BigQuery, Databricks, PostgreSQL, Redshift, Smartsheet, or Snowflake. Go to Connections for details.

Adding a Scheduled Query Job

To add a new scheduled query job, complete the following steps:

  1. In Data Explorer, use the Query Builder or SQL Editor to build your query. See Query Builder for detailed steps.

  2. When you have finished creating and executing your query, click Save > Save as Scheduled Query.

    The Add Job page appears.

  3. In Add Job, enter the Name for your scheduled query.

  4. Set a schedule for your query in hours, days, weeks, or months. Then set a start date and time in UTC. The default date is today’s date.

  5. Select whether to Overwrite or Append the current table in your destination connection. If the table exists, Overwrite deletes the current table and overwrites it with the new table. Append adds the latest query results to the current table.

  6. Select a Destination Connection. Note that only connections of the type mentioned above (BigQuery, Databricks, PostgreSQL, Redshift, Smartsheet, and Snowflake) are available as a destination connection.

  7. Select a Destination Schema if there is more than one schema. Otherwise, the default schema is used.

  8. Enter the Destination Table name for table to be created.

  9. Click Save Changes. If the query is saved successfully, the Status of the scheduled query changes from Draft to Queued.

  10. You can edit the SQL Code in Data Explorer, if necessary.

  11. Click Run Now to run the scheduled query immediately.

  12. The scheduled query now appears in the Jobs queue.

Editing a Scheduled Queries Job

You can modify or delete a scheduled query job at any time by clicking the edit or delete icons in the jobs queue. You can also run a job manually at any time by clicking Run Now.

In the Edit Job page, you can do the following:

  • Change the query schedule, or change the destination write scheme.

  • Change the destination connection and table.

  • View the run history and status, making sure the previous job run was successful.

  • Change the log verbosity.

  • Run a single job manually. You can run multiple jobs in the main Jobs page.

  • Disable the scheduled query temporarily by turning the toggle next to Schedule Query off.

  • Edit the SQL code of the scheduled query.

  • Delete the scheduled query.