Files
2026-09-23 12:29:08 -03:00

770 B

Queries

Named SQL queries registered in vitruvio.json. Plain .sql files — one query per file.

Used as datasources for reports, DBTable components, and referenced by key in scripts via the db lib.

Rules

  • One SELECT per file. No multiple statements, no DDL.
  • Named bind parameters use :paramName syntax (same as inline SQL in scripts).
  • Write ANSI SQL where possible. If DB-specific syntax is unavoidable, keep both Oracle and PostgreSQL in mind — or note the limitation.
  • Queries should be read-only. For INSERT/UPDATE/DELETE, use inline SQL in scripts.

vitruvio.json registration

"queries": [
  {
    "key": "my-query",
    "name": "My Query",
    "source": "queries/my-query.sql",
    "connection": "vitruvio_producao"
  }
]