{"schemaVersion":1,"resourceType":"connector","slug":"docgen","name":"Docgen","catalog":"docgen","description":"Fill Word templates from query rows to produce invoices, letters and other DOCX or PDF documents","language":"Python","categories":["documents"],"repository":"https://github.com/Query-farm/vgi-docgen","license":"MIT","generatedAt":"2026-12-01T18:22:16+00:00","runtime":{"engineVersion":"2.0.1","protocolVersion":"3.4"},"release":{"tag":"v0.5.0","publishedAt":"2026-11-25T18:31:40Z","url":"https://github.com/Query-farm/vgi-docgen/releases/tag/v0.5.0"},"links":{"html":"https://query.farm/products/orchard/connectors/docgen/","llms":"https://query.farm/products/orchard/connectors/docgen/llms.txt","markdown":"https://query.farm/products/orchard/connectors/docgen/index.md","json":"https://query.farm/products/orchard/api/v1/connectors/docgen.json","objects":"https://query.farm/products/orchard/api/v1/connectors/docgen/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=docgen&q={query}"},"authentication":{"mode":"none_declared","guidance":"No service credentials are declared by this connector. Individual datasets, input files or deployments may have their own prerequisites.","interpretation":"Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute(\"CREATE SECRET stripe (TYPE stripe, api_key ?)\", [os.environ[\"STRIPE_API_KEY\"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.","secrets":[]},"deployment":{"local":{"methods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'docgen' AS docgen (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-docgen@v0.5.0 vgi-docgen'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'docgen' AS docgen (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-docgen:0.5.0'\n);"}]}],"pinnedMethods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'docgen' AS docgen (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-docgen@v0.5.0 vgi-docgen'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'docgen' AS docgen (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-docgen:0.5.0'\n);"}]}]},"selfHost":{"instructions":"https://github.com/Query-farm/vgi-docgen","connectionGuide":"https://query.farm/vgi/connect-to-a-worker/","guidance":"Deploy using the connector repository instructions and use its supported HTTP or SSH transport. Replace example URLs with your actual deployment; configure its authentication."},"queryFarm":{"available":true,"console":"https://auth.queryfarm.cloud/console/new?worker=docgen","organizationMonthlyMinimumUsd":10,"pricing":"https://query.farm/products/orchard/hosted/"},"publicDemo":null},"setup":{"extensions":{"duckdb":"SET allow_extension_repositories = 'allowed';\n\nCREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm\n    WITH PREFIX 'https://duckdb-extensions.query.farm';\n\nINSTALL vgi FROM query_farm;\nLOAD vgi FROM query_farm;","haybarn":"INSTALL vgi FROM community;\nLOAD vgi;"},"attachSql":"ATTACH 'docgen' AS docgen (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-docgen@v0.5.0 vgi-docgen'\n);","attachOptions":[],"note":"Install and load VGI, attach the connector using the catalog alias shown here, then create required secrets. Replace placeholders and omit unused optional secret parameters. Satisfy file, network and credential prerequisites before executing a query."},"example":{"title":"See what you can query","sql":"WITH tpl AS (SELECT path FROM docgen.main.sample_templates WHERE name = 'sample_invoice'), invoices AS (SELECT * FROM (VALUES ('Ada Lovelace', '99.50'), ('Grace Hopper', '42.00'), ('Alan Turing', '12.75')) AS t(customer, total)), docs AS (SELECT i.customer, docgen.main.docgen_render(tpl.path, {customer: i.customer, total: i.total}) AS doc FROM invoices AS i CROSS JOIN tpl) SELECT customer, octet_length(doc) AS bytes, doc[1:2] = 'PK'::BLOB AS is_docx FROM docs ORDER BY customer","requiresCredentials":null,"note":null,"objects":[{"name":"docgen.main.sample_templates","kind":"table","links":{"html":"https://query.farm/products/orchard/connectors/docgen/#obj-main-sample_templates","markdown":"https://query.farm/products/orchard/connectors/docgen/objects/table.bWFpbg.c2FtcGxlX3RlbXBsYXRlcw.md","json":"https://query.farm/products/orchard/api/v1/connectors/docgen/objects/table.bWFpbg.c2FtcGxlX3RlbXBsYXRlcw.json"}},{"name":"docgen.main.docgen_render","kind":"scalar_function","links":{"html":"https://query.farm/products/orchard/connectors/docgen/#obj-main-docgen_render","markdown":"https://query.farm/products/orchard/connectors/docgen/objects/scalar_function.bWFpbg.ZG9jZ2VuX3JlbmRlcg.md","json":"https://query.farm/products/orchard/api/v1/connectors/docgen/objects/scalar_function.bWFpbg.ZG9jZ2VuX3JlbmRlcg.json"}}],"evidence":{"status":"captured_result","capturedAt":"2026-12-01T06:12:39+00:00","engineVersion":"2.0.1","protocolVersion":"3.4.0","releaseTag":"v0.5.0","sample":{"columns":["customer","bytes","is_docx"],"types":["VARCHAR","BIGINT","BOOLEAN"],"rows":[["Ada Lovelace",36649,true],["Alan Turing",36647,true],["Grace Hopper",36646,true]],"more":false}},"artifact":null},"objects":{"total":3,"index":"https://query.farm/products/orchard/api/v1/connectors/docgen/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=docgen&q={query}"},"agentTasks":["The docgen worker ships a sample invoice template at the absolute path '/Users/rusty/Library/Caches/uv/archive-v0/SFOkBJ5QguJO-lQSfuA6r/lib/python3.14/site-packages/vgi_docgen/data/sample_invoice.docx'. Using it, render one Word document for customer 'Ada Lovelace' with total '99.50', and return a single boolean column reporting whether a non-empty document BLOB was produced.","Demonstrate the docgen worker's NULL-safety: when the template argument to docgen_render is a NULL VARCHAR, the rendered document must be NULL. Return a single boolean column that is true when the output is NULL.","Using docgen_merge, show that merging an empty input relation (no rows) produces no output document rows. Return the number of output rows as a single column.","The docgen worker ships one or more ready-to-use document templates. Without being told the path, discover how many templates it bundles. Return the count as a single column.","An orders relation names, per row, which of the docgen worker's bundled templates to use: ('Ada Lovelace', 'sample_invoice', '99.50'), ('Grace Hopper', 'sample_letter', '42.00') and ('Alan Turing', 'sample_invoice', '12.75') as (customer, template_name, total). Look each template up by name in the worker's own catalog (do not hard-code a path) and render one document per order with the customer and total as template fields. Keep every order, even one whose template does not exist. Return two columns, customer (VARCHAR) and produced (BOOLEAN, true when a document BLOB was produced), one row per order, ordered by customer.","Using only the docgen worker's own catalog, find the placeholder fields the bundled 'sample_invoice' template expects. Return a single boolean column that is true when its fields are exactly 'customer' and 'total'."],"provenance":{"generatedAt":"2026-12-01T18:22:16+00:00","repository":"https://github.com/Query-farm/vgi-docgen","harvest":{"status":"ok","method":"subprocess","error":null,"vgi_version":"9773130dde"},"catalogVerification":{"verified":true,"status":"passed","total":6,"passed":6,"failed":0,"needs_credentials":0,"location":"uvx --from git+https://github.com/Query-farm/vgi-docgen@v0.5.0 vgi-docgen","transport":"subprocess","environment":{"vgi_extension_version":"9773130dde","haybarn_version":"2.0.1rc3","engine_version":"v2.0.1","python":"3.12.4","platform":"darwin_arm64","protocol_version":"3.4.0"},"checked_at":"2026-12-01T06:11:56+00:00"},"interpretation":"Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."},"interpretation":["Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.","Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.","A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.","Service credentials, external data availability and deployment authentication are separate requirements."]}