Skip to content

Run SQL file

  • PostgreSQL
  • MySQL
  • MariaDB

Run SQL file executes a script without opening it in an editor. The file streams through the statement splitter in the job runner, so large dumps run in flat memory. DELIMITER, dollar quoting and comments are handled as in the query editor, and the file’s own BEGIN and COMMIT run as written.

  1. Right-click a connection or a database in the sidebar and choose Run SQL file….
  2. Choose Choose file… and pick a .sql file, or a gzip-compressed one. The dialog shows its size and the first statements.
  3. Under When a statement fails, pick Stop or Log it and continue.
  4. Choose Run.

Progress and failed statements show in the Jobs panel. Each failed statement is listed with its statement number, line and error message.

Instead of Run, choose Schedule… to run the file on a schedule. Each run executes the file as it is at that moment. On a production or confirm-writes profile, Querybara asks once, when you schedule it (Schedule it), and the runs do not ask again.

querybara run-file runs a file the same way. By default it stops at the first failed statement; --continue keeps going, and --error-log writes the failed statements and their errors to a file. It exits 0 when every statement ran, 1 when some failed with --continue, 2 when it stopped at a failure, and 130 when interrupted.

Terminal window
querybara run-file dev migrate.sql
querybara run-file "postgres://[email protected]/shop" dump.sql.gz --continue --error-log errors.log

Result rows are discarded; use querybara query -f to see them.

Documents Querybara 0.1.1 · built frombc9f5aa