Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Builds, deploys and manages Miaoda (Spark) apps, including design prototypes, logs and automation triggers.
26% 87%+61 ptsof test cases passed
Passed 20 of 23 test cases with the skill, and 6 of 23 without it.
This test ran on v10. v11 is the current version and hasn’t been tested on gemini-3.8-flash yet.
3 of 3 safety checks passed
Not used yet
经妙搭服务端在应用数据库执行 SQL。运行时命令事实以 lark-cli apps +db-execute --help 为准。
用于通过妙搭服务端执行应用数据库 SQL。不要从环境变量里取连接串裸连数据库;本地调试也走这个 shortcut。
--app-id,以及 --sql / --file 二选一(互斥)。--sql:内联 SQL 文本;传 - 时从 stdin 读。绝对路径文件经 stdin 传入:--sql - < <absolute-path>(shell 解析路径,CLI 仅接收内容)。--file:.sql 文件路径,需为工作目录内的相对路径(如 --file ./migration.sql);绝对路径、或经 ../符号链接越出工作目录的路径会被拒绝。文件不在工作目录内时,改用 --sql - < <文件路径> 经 stdin 传入。--env 枚举:dev / online,默认 dev;需要操作线上环境数据库时,显式指定 --env online。high-risk-write(SQL 可含 DML/DDL):任何执行都需 --yes,否则返回 confirmation_required / exit 10。--dry-run 预览不需要 --yes。transactional=false;不默认包事务。lark-cli apps +db-execute --app-id app_xxx --env dev --sql "select * from orders limit 5" --yes
lark-cli apps +db-execute --app-id app_xxx --env dev --file ./migration.sql --dry-run
# 绝对路径文件 / cwd 不固定:经 stdin 传入
lark-cli apps +db-execute --app-id app_xxx --env dev --sql - --yes < /Users/.../migrations/0001_init.sql
data.results[];每个元素对应一条 SQL,常见字段有 sql_type、data、record_count、affected_rows。ok:false 的 envelope(exit 非 0),从 data 读 results[](全部逐条结果,失败语句 sql_type 为 ERROR)、statement_index、error_code、error_message、rolled_back 和 note,决定从哪条继续。--yes;无 --yes 会返回 confirmation_required / exit 10。
--yes 执行。--dry-run 预览(无需 --yes),向用户确认后再带 --yes 执行;不要在用户不知情时自动补 --yes。BEGIN / COMMIT,不要假设 CLI 会包事务。Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.