{
 "schema_version": 1,
 "generated": "2026-10-26",
 "id": "masumedb-masume--export-query-results-in-scripts",
 "repo": "masumedb/masume",
 "repo_url": "https://github.com/masumedb/masume",
 "repo_slug": "masumedb-masume",
 "title": "Run SQL in a script and export results to a file",
 "page_title": "How to run SQL in a script and export results to a file with Masume",
 "summary": "Run statements headless and write CSV, JSON, or Parquet output for a pipeline.",
 "who": "A data engineer or CI maintainer who needs a query result as a file in a shell job.",
 "problem": "Exporting data by hand from a GUI breaks repeatable reports and nightly jobs.",
 "outcome": "A command writes the query result to a file that a later step can read.",
 "steps": [
  "Install Masume with `brew install masumedb/tap/masume` or another method from the README",
  "Run `masume run -p shop-prod -f json 'select count(*) from orders'` to check the connection",
  "Run `masume run ./notes.db -f csv 'select * from notes limit 100000' > notes.csv` to export to CSV",
  "Run `masume run -p shop -f parquet 'select * from orders' > orders.parquet` for a Parquet file"
 ],
 "agent_prompt": "In the masume repo, run `masume run -p <profile> -f json 'select count(*) from <table>'` and report the JSON output. Expected output: one JSON result with a count. Verify that the exit code is 0 before the next step uses the output.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "Check docs/headless.md for exit codes and format details before depending on them in CI.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "go",
 "requirements": [
  "A terminal on macOS, Linux, or Windows",
  "A database you can reach, or a local SQLite file",
  "One install method: Homebrew, npm, Go 1.27 or later, or a release package"
 ],
 "risk": "sensitive",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/masumedb-masume/export-query-results-in-scripts/",
 "md": "https://dedupedai.com/use-cases/masumedb-masume/export-query-results-in-scripts/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/masumedb-masume--export-query-results-in-scripts.json",
 "api_version": "v1"
}
