Skip to main content

query

Preview
This feature is in preview and is subject to change.

Execute a SQL query against MotherDuck and write results to stdout.

Usage

motherduck query [options] [sql]

Arguments

ArgumentDescription
sqlThe statement to run. Omit it when reading from --file

Options

OptionDescription
--file <path>Read SQL from a file
--timeout <seconds>Query timeout in seconds. Defaults to 120

Examples

motherduck query "SELECT count(*) FROM sample_data.nyc.taxi"
motherduck query --file monthly_report.sql
motherduck query --file backfill.sql --timeout 600
motherduck query "SELECT * FROM sample_data.nyc.taxi LIMIT 100" -o csv > trips.csv
motherduck query "SELECT * FROM sample_data.nyc.taxi LIMIT 100" -o json | jq '.[0]'