TugQL

TugQL examples

Read complete TugQL examples for a Git-backed source and a cross-database join, with their execution boundaries stated.

Join Chinook with geo-ingitdb

-- one query, two databases
databases (
  chinook = 'https://cloud.openvaultdb.com/v1/databases/chinook'
  geo     = 'https://github.com/ingitdb/geo-ingitdb'
)
from chinook::Invoice as i
join geo::country_aliases as a
  on i.BillingCountry = a.alias
join geo::population_wb as p
  on a.country = p.country
group by i.BillingCountry, p.population
order by Total desc
select (
  i.BillingCountry as Country
  SUM(i.Total) as Total
  p.population as Population
)

Open this exact TugQL text in DataTug. The link puts the text in a URL fragment; execution depends on access to both sources. The tutorial explains each clause and the federated execution path.

Read country aliases from a Git-backed source

databases (
  geo = 'https://github.com/ingitdb/geo-ingitdb'
)
from geo::country_aliases as a
where a.country = 'ie'
select a.alias, a.country

The Git-backed how-to shows the source record, adapter and policy requirements. The query text alone does not mount or authorize the repository.

Where to run them

These are TugQL queries. QueryDock currently runs SQL with PGlite, SQLite and DuckDB, so a QueryDock run link for these examples would not execute them. For text syntax, see the cheat sheet; for the structured YAML form, see TugQT.

All documentation