Skip to content

Generating SQL Extract Steps with AI

The Extract SQL workflow step runs a read-only SELECT against your project’s data and writes the result into a new table. Writing that query by hand means knowing the source tables, their columns, and the SQL to shape them.

The step editor can write the query for you. Describe the output you want in plain language and the AI Assistant produces the SELECT — and if you don’t tell it which tables to read from, it examines the project’s tables and picks the relevant ones itself. The generated SQL and detected columns are shown for review and stay fully editable before you save the step.

From a workflow’s Steps view, click Create Step and choose either:

  • Tables → Extract SQL, or
  • AI → SQL Extract (AI Assisted)

Both open the same Extract SQL step editor, which now includes a Generate SQL with AI panel at the top of the SQL Extract Parameters page.

  1. (Optional) Choose source tables. In the Source Tables list, select one or more tables the query should read from. Leave the list empty to let the Assistant examine the project and choose the relevant tables for you.

  2. Describe what you want. In the Describe box, write the outcome in plain language — for example, “classify each ledger account into an activity pool based on its account number range”.

  3. Click Generate SQL. The Assistant writes a single read-only SELECT, validates it by running it, and fills in:

    • the SQL Select Query editor with the generated statement, and
    • the Table Data Selection mapping page with the detected columns.

    If you left the source list empty, the tables the Assistant chose are selected back in the list so you can see what it used and adjust.

The generated SQL is a starting point, not a black box:

  • Edit it freely. The SQL editor is fully editable — refine the query, add a join, or change the column list before saving. (To join several tables, you can select multiple source tables, or simply edit the generated query.)
  • Pick a target table. Choose or name the Target Table the step writes its result into.
  • Save the step. It is saved as an ordinary Extract SQL step and runs as part of the workflow like any other.
  • The Assistant only writes read-only SELECT statements; it never produces INSERT, UPDATE, DELETE, or other data-changing SQL.
  • Generation does not create or run the step — it only drafts the query and previews the columns. The step is created when you save it, and runs when the workflow runs.
  • The generated query reads in your tables’ display names — each table is bound once at the top of the query under its name (so the columns, joins, and filters all read in plain names rather than internal analyzetable_… ids). The real identifiers are restored automatically when you save, so the query runs unchanged. A table whose name isn’t unique keeps its identifier.