How to Schedule Queries

Schedule your queries to run any time and automate your reporting. This feature is only available to Premium Team users.

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:

  1. Under Run Against, choose your database connection. You can only schedule queries against a cloud connection.
  2. Under Run On, you can schedule a query to run once at a specific day/time, or you can have it repeat every hour, day, week, etc.
  3. Next Run gives you a preview of when PopSQL will run your query.

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.

Notifications

On the Notifications tab, you can specify when PopSQL should notify you about the scheduled query.

  • Always: Every time the query runs, we'll send an email.
  • If there are results: If there are one or more rows returned, we'll send an email.
    • 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 an email.
    • Example: If you're expecting user sign ups every hour, you can tell PopSQL to email you if there are no sign ups in the last hour.

By default, the notification email will contain a link to view the CSV. This link can only be accessed by members of your organization. However, you can optionally include the CSV as an attachment of the email: