Skip to main content

export Command

The export command writes the outputs: of a workflow to their database tables. It reads the records that the last run stored. It calls no model, so you can run it again and again.

bash
BASH
agac export -w <workflow-name> [options]

agac run and agac retry write the same tables when they finish with each action complete. Use export when that write failed, or when you changed a table and want it written again. See Databases for the connections: and outputs: keys.

Options​

OptionDescription
-w, --workflow NAMEThe workflow name (required). -a names the same option.
-A, --action NAMEWrite only the output of this action. The action must have an output. If no output names it, the command stops and lists the actions that have outputs

Examples​

Write each table again after a failed write​

When the write at the end of a run fails, the run prints this message:

text
TXT
Every action finished, but writing the outputs failed. The results are stored: write them again with agac export -w ticket_triage

Correct the cause, for example a table with a column that does not accept null. Then write the tables:

bash
BASH
agac export -w ticket_triage

The command prints one line for each table:

text
TXT
Wrote 120 rows to ticket_classification
Wrote 14 rows to ticket_escalations

If two connections each have a table with the same name, the line names the connection too: Wrote 120 rows to results on warehouse.

Write the table of one action​

bash
BASH
agac export -w ticket_triage -A classify_ticket

When the command stops​

The command checks each output before it writes a table. These conditions stop the command, and the error names the cause:

CauseWhat to do
The workflow declares no outputs:Add an outputs: block to the workflow, or do not use export
An output names an action that the workflow does not runCorrect the action name
An output names a connection that agent_actions.yml does not declareAdd the connection to connections:, or correct the name
The driver of a connection is not installedInstall the extra that the error names, for example pip install 'agent-actions[postgres]'
A table, key or carry name is not a plain nameUse letters, digits and underscores, with a dot between a schema and a table
Two outputs write the same table on the same connectionGive each output its own table
Two different records share the key of a merge or append outputSet key to columns that tell the records apart, or use mode: replace. See Modes
agac run or agac retry of the same workflow is in progress (exit code 75)Wait for the run to finish. A table written during a run would hold only a part of the records

If one table fails, the tables that the command wrote before it stay written. Correct the cause and run the command again. A merge or a replace that you write two times gives the same table as one write.