Skip to content

Guide

Schedule SQL queries to CSV email

scheduled SQL exports / email / operations

Learn how to schedule a saved SQL query, generate CSV output, and send a secure download link by email through a private database agent.

Many teams still run the same SQL query every Monday, export the result as CSV, and send it by email. The work is simple, but it is also easy to forget, hard to audit, and usually owned by one person.

Taavik turns that manual workflow into a schedule. Save the SQL once, choose CSV, set the cadence, and deliver a secure download link to the inbox through the on-premise agent.

If the query already exists in your team's notes, start by moving it into the saved SQL query library. From there, the same query can become one of your scheduled SQL exports.

Why manual CSV exports break

Manual exports look harmless when there are one or two of them. Then the team adds a finance extract, an operations check, a missing-documents report, and a daily data-quality probe.

The pattern starts to fail in predictable ways:

  • the owner is on vacation.
  • the SQL lives on a laptop.
  • recipients do not know whether the file is current.
  • nobody can see the last run status.
  • the export is repeated from memory with small changes.

The result is not just wasted time. The team stops trusting the export.

How Taavik schedules the query

In Taavik, a schedule starts from a saved query. The SQL lives in the workspace, with a name, description, variables, and run history.

The schedule adds the operational layer:

  • frequency.
  • timezone.
  • output format.
  • email destination.
  • active or disabled state.

The export runs at the configured time. The generated file is made available through a secure download link, then the email delivery is logged with the schedule run.

Why the private agent matters

Many SQL export tools expect direct cloud access to the database. That is not how private operational databases are usually managed.

Taavik uses a private database agent. The agent runs inside your network and executes the query from there. The cloud coordinates the schedule and receives the result only when you explicitly run or schedule the export.

Use a read-only database role. Taavik rejects DML and DDL before dispatch, and the agent enforces statement timeouts.

What the recipient receives

The recipient receives an email with a secure download link. The link is the delivery surface for the generated file.

That distinction matters. A link can expire, be audited, and keep larger exports out of mailbox storage. The schedule history still shows what ran, when it ran, how many rows came back, and whether delivery succeeded.

When to use CSV instead of Excel

CSV is the right default when the recipient is another system or a technical team. It is compact, easy to parse, and stable over time.

Excel is better when the recipient expects filters, tabs, or manual review. Finance and back-office teams often prefer it. For a machine workflow, CSV usually wins.

What to automate first

Start with the export that already has a calendar reminder. Good candidates are finance reconciliation, failed transactions, orders stuck in processing, and customer records missing required fields.

Pick one query, save it, schedule it, and send the first delivery through Taavik. Once that works, the rest of the manual export list usually becomes obvious.

See the full scheduled SQL exports page for the product workflow.