maestro/docs/tools/sqlite.md
2026-06-03 05:08:00 +00:00

43 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SQLite
ワークスペース内の SQLite データベースに対してクエリを実行する。
## 基本
```js
SQLite({
db_path: "input/data.db",
query: "SELECT name, price FROM products WHERE category = 'A' LIMIT 10"
})
```
## edit 制御
- **edit: false の movement**: SELECT のみ許可(読み取り専用)
- **edit: true の movement**: INSERT / UPDATE / DELETE / CREATE / ALTER 等の DDL/DML も許可
## 用途
- 既存の SQLite データベースの内容調査
- データ集計GROUP BY, JOIN
- スキーマ確認(`SELECT name FROM sqlite_master WHERE type='table'`
- 加工後データの新規 DB への書き込みedit movement のみ)
## クエリの実行結果
- 行は JSON 配列で返る
- 大量行はトークン消費が大きいので **必ず LIMIT を付ける** か WHERE で絞る
- 1 万行を超えるような結果は LIMIT 100 程度から始めて段階的に確認
## 入力ファイルの場所
- workspace 内のパス(`input/`, `output/`, `data/` 等)
- 絶対パスは禁止
- DB ファイルが存在しないときはedit movement なら)新規作成される
## トラブルシューティング
- **database is locked**: 他プロセスが DB を開いている。暫く待ってリトライ
- **no such table**: スキーマ確認 → テーブル名スペルチェック
- **disk I/O error**: ディスク容量・パーミッション確認