Does my query language need a function for this?
In developmentsql
Call a pipe from a query
A query language shouldn’t grow a function for everything. Pipe the result through a step instead: the same lowercase and mask pipes, applied to rows from a TugQL query. The syntax is a draft and no released tool runs it yet.
In development — not released yet
This page shows work in development, not something you can run. No released tool runs it yet, so there is nothing to download or run today.
A pipe is a data-processing step with declared inputs and outputs.
What goes in, what comes out
Input rows — Customers
Id Email
1 Alice@Example.COM
2 Bob.Stone@Example.orgQuery (TugQL — draft syntax, table form)
pipes (
lower = 'openflange/lowercase@^0.1'
mask = 'openflange/mask-email@^0.1'
)
with Emails as (
from Customers as c
select c.Id, c.Email
) | lower | mask
from Emails as e
select e.Id, e.EmailOutput rows
Id Email
1 a***e@example.com
2 b*******e@example.orgWhat to notice
- Everything inside the parentheses runs in the database. The bar (
|) hands the resulting rows to the pipe. - The
pipes (…)block gives each pipe a short alias and a version range, which a lockfile then pins — the same references a pipeline uses. - TugQL is a portable query language. OpenFlange pipes are its extension mechanism: the syntax is documented at tugql.org/docs/pipes and the contract in RFC 0002. The table form is merged into the
tugqlGo package (not yet tagged); the syntax may still change, including how the columns of a row map to the port of a pipe. - The query shown is the table form: a whole result set goes through the pipe. That form is available in the
tugqlGo package (dal-go/dalgo, merged to main, not yet tagged). The scalar form, a pipe called like a function on one value, is still only proposed; it needs function-like pipes: one input, one output, one-to-one and deterministic. - The rows are illustrative: they were not produced by a run. The
examples/tugqldirectory of the repository is a README only, and there is no released host you can run this in yet: DataTug, the first host, is in development.