Exit codes
- CLI
Every querybara command exits with one of four codes. Compare commands follow diff(1): 0 means
no differences, 1 means differences, 2 means trouble.
| Code | Meaning |
|---|---|
| 0 | Success, or no differences |
| 1 | Differences found or remaining; a failed connection test; a run that finished but skipped rows or failed statements |
| 2 | An error: bad arguments, a connection or SQL failure, a refused or unconfirmed statement |
| 130 | Interrupted with Ctrl + C |
Unknown options and missing arguments exit with 2. --help and --version exit with 0. When the
program reading the output goes away, as with | head, the run stops quietly and exits with 0.
By command
Section titled “By command”| Command | 0 | 1 | 2 |
|---|---|---|---|
test |
Every step passed | A step failed | Error |
query |
Every statement ran | Not used | A statement failed or was refused, or another error |
compare |
No differences | Differences found, or remaining after --apply |
Error |
data-compare |
No differences for the selected actions | Differences found, or remaining after --apply |
Error |
ddl |
Script written | Not used | Error |
import |
Imported | Imported, but rows were skipped | Failed |
export |
Exported | Not used | Failed |
run-file |
Every statement ran | Some statements failed with --continue |
Stopped at a failure, or another error |
transfer |
Transferred | Transferred, but rows were skipped | Failed or refused |
backup |
Backed up | Not used | Failed |
restore |
Restored | Restored, but statements failed (--continue) |
Failed |
profiles |
Done | Not used | Error |
Every command exits with 130 when interrupted.
In a script
Section titled “In a script”querybara compare shop-model shop-prod --out deploy.sqlcase $? in 0) echo "shop-prod matches the model" ;; 1) echo "differences written to deploy.sql" ;; *) echo "compare failed" >&2; exit 1 ;;esacquery exits with 2 when any statement failed, also with --continue. To tell a partial run
from a failed one, use run-file --continue, which exits with 1.
Related
Section titled “Related”Documents Querybara 0.1.1 · built frombc9f5aa