Execute SQL from file

Source: Issue #276

Is there a way to import a bunch of SQL from a file, similar to the source command in MySQL?

Yes, this works with a file of SQL statements, for example:

$ cat statements.sql
CREATE TABLE t1 (a INT PRIMARY KEY, b STRING);
INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb');

$ cockroach sql --user=maxroach --host=roachcluster.com ---port=26257 --database=critterdb < statements.sql
CREATE TABLE
INSERT 2

Also, from within the SQL shell, you can use \| to run the output of an external command as SQL statements.

Docs: Use the Built-in SQL Client