{"id":50311290,"url":"https://github.com/dagucloud/duckdb","last_synced_at":"2026-05-28T21:01:50.610Z","repository":{"id":358611850,"uuid":"1242075073","full_name":"dagucloud/duckdb","owner":"dagucloud","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-18T06:13:19.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-18T08:30:10.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dagucloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-18T05:33:25.000Z","updated_at":"2026-05-18T06:13:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dagucloud/duckdb","commit_stats":null,"previous_names":["dagucloud/duckdb"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dagucloud/duckdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagucloud%2Fduckdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagucloud%2Fduckdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagucloud%2Fduckdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagucloud%2Fduckdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagucloud","download_url":"https://codeload.github.com/dagucloud/duckdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagucloud%2Fduckdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33626142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-28T21:01:46.285Z","updated_at":"2026-05-28T21:01:50.605Z","avatar_url":"https://github.com/dagucloud.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dagu DuckDB Action\n\nOfficial Dagu action for running DuckDB SQL through the DuckDB CLI.\n\nThis action keeps DuckDB out of the Dagu core binary, so Dagu can remain\nportable and cgo-free. The action pins the DuckDB CLI with Dagu `tools`, which\nuses aqua internally.\n\n## Usage\n\n```yaml\ntype: graph\n\nsteps:\n  - id: query\n    action: duckdb@v1\n    with:\n      query: |\n        SELECT 42 AS answer, 'duckdb' AS engine;\n\n  - id: print_result\n    depends: [query]\n    run: printf '%s\\n' '${query.outputs.result}'\n```\n\nThe default output format is DuckDB JSON mode, so `result` is a JSON string:\n\n```json\n[{\"answer\":42,\"engine\":\"duckdb\"}]\n```\n\n## Existing DuckDB Files\n\nUse `database` to run SQL against an existing DuckDB file:\n\n```yaml\ntype: graph\n\nsteps:\n  - id: query_existing_db\n    action: duckdb@v1\n    with:\n      database: /data/analytics.duckdb\n      query: |\n        SELECT count(*) AS users FROM users;\n```\n\nUse `workdir` when the database path or files referenced by SQL should be\nresolved relative to a directory:\n\n```yaml\ntype: graph\n\nsteps:\n  - id: query_project_db\n    action: duckdb@v1\n    with:\n      workdir: /data/project\n      database: analytics.duckdb\n      query: |\n        SELECT * FROM read_csv_auto('events.csv') LIMIT 10;\n```\n\nThe database file must exist on the worker that runs the action. In distributed\nshared-nothing mode, use a shared mount or an absolute path available on that\nworker. `:memory:` is scoped to one action invocation, so it cannot share state\nbetween multiple action steps.\n\n## Multiple Operations\n\nFor tightly coupled operations, run multiple SQL statements in one action. This\nkeeps them in one DuckDB process and lets you use a transaction boundary:\n\n```yaml\ntype: graph\n\nsteps:\n  - id: update_metrics\n    action: duckdb@v1\n    with:\n      database: /data/analytics.duckdb\n      query: |\n        BEGIN TRANSACTION;\n\n        CREATE TABLE IF NOT EXISTS metrics (\n          name VARCHAR,\n          value INTEGER\n        );\n\n        INSERT INTO metrics VALUES ('runs', 1);\n\n        UPDATE metrics\n        SET value = value + 1\n        WHERE name = 'runs';\n\n        COMMIT;\n\n        SELECT * FROM metrics;\n```\n\nFor separate DAG visibility, use multiple action steps against the same database\nfile and connect them with `depends`:\n\n```yaml\ntype: graph\n\nsteps:\n  - id: insert_rows\n    action: duckdb@v1\n    with:\n      database: /data/analytics.duckdb\n      query: |\n        INSERT INTO metrics VALUES ('jobs', 10);\n\n  - id: update_rows\n    depends: [insert_rows]\n    action: duckdb@v1\n    with:\n      database: /data/analytics.duckdb\n      query: |\n        UPDATE metrics SET value = value + 5 WHERE name = 'jobs';\n\n  - id: select_rows\n    depends: [update_rows]\n    action: duckdb@v1\n    with:\n      database: /data/analytics.duckdb\n      readonly: true\n      query: |\n        SELECT * FROM metrics WHERE name = 'jobs';\n\n  - id: print_result\n    depends: [select_rows]\n    run: printf '%s\\n' '${select_rows.outputs.result}'\n```\n\nKeep write operations ordered with `depends`. Parallel writes to the same DuckDB\nfile can conflict because DuckDB uses file-level locking semantics.\n\n## Artifacts and Large Results\n\nThe `result` output is for small values that need to flow through Dagu variables:\ncounts, IDs, status rows, or compact JSON. Do not use `${step.outputs.result}`\nas a transport for large rowsets.\n\nWhen the query result itself should be kept with the DAG run, stream DuckDB\nstdout directly to a run artifact:\n\n```yaml\ntype: graph\n\ntools:\n  - duckdb/duckdb@v1.5.2\n\nsteps:\n  - id: export_rows\n    run: |\n      duckdb -batch -bail -no-stdin -csv /data/source.duckdb \\\n        -c \"SELECT id, name, score FROM source_table WHERE score \u003e= 80\"\n    stdout:\n      artifact: exports/selected_rows.csv\n```\n\nThis keeps the CSV out of Dagu output variables while making it available in the\nrun's Artifacts tab.\n\nYou can then load that artifact file in a later DuckDB step when the artifact\ndirectory is readable by that step:\n\n```yaml\ntype: graph\n\ntools:\n  - duckdb/duckdb@v1.5.2\n\nsteps:\n  - id: export_rows\n    run: |\n      duckdb -batch -bail -no-stdin -csv /data/source.duckdb \\\n        -c \"SELECT id, name, score FROM source_table WHERE score \u003e= 80\"\n    stdout:\n      artifact: exports/selected_rows.csv\n\n  - id: insert_rows\n    depends: [export_rows]\n    action: duckdb@v1\n    with:\n      database: /data/target.duckdb\n      query: |\n        INSERT INTO target_table\n        SELECT *\n        FROM read_csv_auto('${DAG_RUN_ARTIFACTS_DIR}/exports/selected_rows.csv');\n```\n\nFor large or typed datasets, prefer writing Parquet from SQL:\n\n```yaml\nsteps:\n  - id: export_parquet\n    action: duckdb@v1\n    with:\n      database: /data/source.duckdb\n      query: |\n        COPY (\n          SELECT id, name, score\n          FROM source_table\n          WHERE score \u003e= 80\n        )\n        TO '${DAG_RUN_ARTIFACTS_DIR}/exports/selected_rows.parquet'\n        (FORMAT parquet);\n\n  - id: insert_parquet\n    depends: [export_parquet]\n    action: duckdb@v1\n    with:\n      database: /data/target.duckdb\n      query: |\n        INSERT INTO target_table\n        SELECT *\n        FROM read_parquet('${DAG_RUN_ARTIFACTS_DIR}/exports/selected_rows.parquet');\n```\n\nIn distributed shared-nothing mode, an artifact path may be worker-local while\nthe run is still executing. For cross-worker data handoff, use a shared mounted\npath, object storage, or keep the operation inside one DuckDB statement with\n`ATTACH` / `INSERT INTO ... SELECT`.\n\n## Inputs\n\n| Name | Type | Required | Default | Description |\n|------|------|----------|---------|-------------|\n| `query` | string | Yes | | SQL passed to `duckdb -c`. |\n| `database` | string | No | transient in-memory database | Database file path. Use an absolute path when the file lives outside the action workspace. |\n| `workdir` | string | No | action workspace | Directory to `cd` into before running DuckDB. Use this when SQL references local files with relative paths. |\n| `format` | string | No | `json` | Output format: `json`, `csv`, `table`, `markdown`, `line`, `list`, or `column`. |\n| `readonly` | boolean | No | `false` | Open the database in read-only mode. |\n\n## Outputs\n\n| Name | Type | Description |\n|------|------|-------------|\n| `result` | string | Raw DuckDB stdout in the selected format. |\n\n## Local Development\n\nUse `source:` to call a local checkout:\n\n```yaml\nsteps:\n  - id: query\n    action: source:file:///path/to/duckdb@local\n    with:\n      query: SELECT 1 AS ok;\n```\n\nRemote actions run in their own action workspace. If a query needs files from a\ncaller workspace, pass `workdir` and use paths that exist on the worker running\nthe action.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagucloud%2Fduckdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagucloud%2Fduckdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagucloud%2Fduckdb/lists"}