How to Schedule Queries

Schedule your queries to run any time and automate your reporting. Have the results sent to email or Slack. Free and Premium plans allow for 2 schedules while Business and Enterprise feature an unlimited amount.

Scheduling a query

To schedule your query, look for the Schedule Query button under the name of your query.

That will open the scheduler modal:

Give your schedule a name, then fill in the specific details. Run Against refers to the database connection we'll use to run the query (note: it must be a cloud connection). The default connection will be the connection your query uses, but you can select any other.

Next, decide how often this query should run. Every hour, every day, or just once - you can specify the frequency that the schedule will refresh this query.

Note that the granularity of timing varies by plan.

  • Free: Weekly frequency
  • Premium: Daily frequency
  • Business: Hourly frequency
  • Enterprise: By the minute

When your details are all filled in, head to the notifications tab to define where we'll send the results.

716

Note: If you previously scheduled queries with a frequency that is not supported by your plan, these schedules will all continue to run as they were set up initially. New schedules will only have options that adhere to the frequency set by plan.

Notifications

On the Notifications tab, you can specify when and where PopSQL should notify you when the scheduled query completes. Note that if the schedule fails to run, you will always be notified.

Notify

Under Notify, you have four options:

Always

Every time the query runs, we'll send a notification.

If there are results

If there are one or more rows returned, we'll send a notification. Example: If your average order size is $100, you can tell PopSQL to alert you when you get an order that's > $500.

If there are no results

If there are zero rows returned, we'll send a notification. Example: If you're expecting user sign ups every hour, you can tell PopSQL to notify you if there are no sign ups in the last hour.

Never

The schedule will still run the query, but you will not be notified.

Channel

PopSQL can notify you via email or Slack.

Email

If you set the channel to Email, then you'll be prompted to specify some email recipients.

By default, the notification email will contain a link to see the results, and a link to download the CSV data.

Optionally, you can tell PopSQL to include the CSV or PDF as an attachment in the email, and to optimize the images for mobile devices. The maximum file size for email attachments sent from PopSQL is 50 MB.

Slack

If you set the channel to Slack, then you'll be prompted to specify the Slack channels you want notified when the query completes. You can also choose to direct message a user on Slack by entering their username.

Variables

If your query has variables, you'll see a Variables tab where you can create specify the value PopSQL should use when it runs your query. Multiple people can create multiple schedules with their own variable values. For example, your account managers might want to schedule the same query to run every morning, but with a different account_id.

Once all parameters have been set, click Save schedule and expect to see your query results in your inbox or Slack!

Managing schedules

If for any reason you need to make changes to your schedule, head back to the query and find the scheduler through the Schedule button under the title, or in the details tab.

From there, you can enter the modal to make changes or, if you need to, delete the schedule.

Need more control around scheduled queries? Check out the schedule approval feature that flows every schedule through admin approval before going into action.


Cookie settings