Querious Help 5

Running SQL Script Files

Executing a .sql file without opening it in an editor.

FileRun SQL Script… runs a SQL file directly against the current connection. Unlike opening it in a query editor, it streams the file instead of loading it into memory, so use it for dumps and migrations of any real size.

Running a Script #

  1. Choose FileRun SQL Script….
  2. Select the file. Plain text, .sql, .mysql and .postgresql files are offered.
  3. Choose the database to run against (like the selected database in the Query view) and the file's text encoding.
  4. Start it. It runs as a background task, so you can keep working. Follow it in WindowShow Background Tasks.

Statements that name their own schema override the database you chose. The chosen database is only the default for statements that don't.

Errors #

When a statement fails, Querious asks whether to stop or continue with the rest. Stopping is usually right for a dump being restored. Continuing suits a batch of independent statements.

Choosing the Right Tool #

Situation Use
A large dump, or a file you want to run and not read Run SQL Script…
SQL you want to read, edit, or run in pieces Open it in a query editor
A dump with import options (character set, structure only, specific tables) Importing
A PostgreSQL custom-format dump pg_dump and pg_restore