Answer questions about a big CSV, Excel or Parquet file with SQL (DuckDB) in ONE command, instead of reading the rows into the conversation: describe a file (columns, types, row count, sample), totals and averages by group (sales by region and month), filter rows, join two files, run any SQL, and export the result as CSV, Excel or Parquet. Handles 100,000+ rows in seconds. Use for: what is in this file, total sales per region, top 10 customers, rows where amount > 1000, average per month, combine customers and orders, turn this question into a table. Triggers: CSV, large file, pivot, group by, sum by, average by, top N, filter rows, SQL, Parquet, how many rows, what columns.
Say it in your own words; the assistant finds this recipe by itself. Examples:
Answer questions about a big CSV, Excel or Parquet file with SQL (DuckDB) in ONE command, instead of reading the rows into the conversation: describe a file (columns, types, row count, sample), totals and averages by group (sales by region and month), filter rows, join two files, run any SQL, and export the result as CSV, Excel or Parquet. Handles 100,000+ rows in seconds. Use for: what is in this file, total sales per region, top 10 customers, rows where amount > 1000, average per month, combine customers and orders, turn this question into a table. Triggers: CSV, large file, pivot, group by, sum by, average by, top N, filter rows, SQL, Parquet, how many rows, what columns.
python3 /skills/csv-query/scripts/query.py <verb> … — inputs in /work/in (.csv, .tsv, .parquet,
.xlsx), results in /work/out as .csv, .xlsx, .parquet or .md (a Markdown table for small
results you want to show). Every verb prints one OK … line, or ERROR … with the SQL error.
| Need | Command |
|---|---|
| What is in the file | query.py describe /work/in/sales.csv (columns, types, rows, 5 sample rows) |
| Totals by group | query.py summary /work/in/sales.csv /work/out/by-region.xlsx --by region --agg units:sum,price:avg,*:count |
| By two columns, sorted | query.py summary /work/in/sales.csv /work/out/by-month.csv --by region,"strftime(date,'%Y-%m') AS month" --agg units:sum --order "units_sum DESC" |
| Filter rows | query.py filter /work/in/sales.csv /work/out/dk-large.csv --where "region = 'DK' AND units >= 20" [--limit 1000] |
| Join two files | query.py join /work/out/joined.csv /work/in/sales.csv /work/in/products.csv --on product [--how left|inner] |
Any SQL (file is table t, second file u) |
query.py sql /work/in/sales.csv /work/out/top.md --query "SELECT product, SUM(units*price) AS revenue FROM t GROUP BY 1 ORDER BY 2 DESC LIMIT 10" |
| Two files in SQL | add --second /work/in/products.csv and use u |
sum, avg, count, min, max, median, count_distinct; *:count counts rows.
Result columns are named <col>_<agg> (units_sum).describe; then write the smallest query that answers the question and show the person
the OK line plus the table (.md) or the download link.SKILL.mdscripts/__pycache__/query.cpython-311.pycscripts/query.pyWritten by Percerno, MIT licence.