An open, portable query language and structured query tree (TugQT) for relational, document, API, and graph-connected data.
TugQL (formerly known as DTQL) is a vendor-neutral query definition language designed to query disparate SQL, NoSQL, REST/GraphQL APIs, and graph-connected data sources without proprietary query lock-in.
It provides a dual representation with 1:1 lossless round-trip fidelity:
- TugQL (Text Syntax): A clean, human-friendly SQL-like query language designed for writing, editing, and interactive exploration.
- TugQT — Tug Query Tree (Structured Syntax): A declarative JSON/YAML representation of the parsed/canonical query tree. Perfect for version control, AST manipulation, automated policy evaluation, and execution across heterogeneous storage backends without requiring a bespoke DSL parser.
| Repository | Purpose |
|---|---|
tugql/tugql |
The canonical specification, JSON Schema (draft 2020-12), test vectors, and language documentation. |
tugql/.github |
Community health files and organization profile. |
TugQL is actively integrated across the open data stack:
- Go Reference Implementation:
github.com/dal-go/dalgo/dtql— Full parser, validator, query planner, and executor for Go backends. - TypeScript / JavaScript:
@dal-go/dalgo— AST parser, validator, and browser/Node executors. - DataTug:
datatug/datatug-core,datatug-cli,datatug-apps— Native support for saved queries, visual builders, and Git-native.datatugprojects. - OpenVaultDB:
openvaultdb/openvaultdb-go— Query routes and execution adapters.
FROM orders o
JOIN customers c ON o.customer_id = c.id
WHERE o.status == 'completed' AND o.total > 100
GROUP BY c.country
HAVING revenue > 1000
ORDER BY revenue DESC
SELECT
c.country,
COUNT(*) AS total_orders,
SUM(o.total) AS revenuefrom:
name: orders
alias: o
join:
- name: customers
alias: c
on:
op: ==
left: { field: o.customer_id }
right: { field: c.id }
where:
op: AND
args:
- { op: ==, left: { field: o.status }, right: { value: completed } }
- { op: '>', left: { field: o.total }, right: { value: 100 } }
groupBy:
- field: c.country
having:
op: '>'
left: { field: revenue }
right: { value: 1000 }
orderBy:
- field: revenue
desc: true
columns:
- field: c.country
- aggregate: { function: count, args: [{ star: true }] }
as: total_orders
- aggregate: { function: sum, args: [{ field: o.total }] }
as: revenueDTQL has been renamed to TugQL.
- Canonical website: https://tugql.org
- Former domain:
dtql.org(permanently redirects totugql.org)- Former repository:
datatug/dtql(permanently redirects totugql/tugql)- Query Language: TugQL
- Query Tree Structure: TugQT
- 🌐 Website: https://tugql.org
- 📖 Specification & Documentation: github.com/tugql/tugql
- ⚖️ License: Apache 2.0