Adapters (@signalql/adapters)
@signalql/adapters provides concrete compile/run behavior across the current language (v0.1 → v0.4):
postgresAdapter— compiles to parameterized SQL through@signalql/compiler(incl. v0.3 aggregates and v0.4 graph/lineage recursive SQL).csvAdapter— evaluates SignalQL AST in-memory against demo events (v0.3) and a demo graph (v0.4MATCH/TRACE/CONTEXT); no database required.clickHouseAdapter— minimal SQL mapping for count/group/funnel.bigQueryAdapter— minimal SQL mapping for count/group/funnel.
Interface
Each adapter exposes:
describe()setup()instructionscompile(query, context?)- optional
run(query, context?)
context.tableMap binds logical sources (events, users, sessions) to physical tables.
Setup and limitations
CSV adapter
- Requires
context.demoEventsrows (events) or a demo graph for v0.4 graph queries. - Supports local sample/demo workflows.
- Evaluator supports
FROM eventsretrieve/aggregates/funnels and v0.4 graph patterns,TRACE, andCONTEXT FORagainst bundled fixtures.
Postgres adapter
- Uses safe source binding and parameterized SQL.
- Pair with CLI or your own
postgresclient execution path.
ClickHouse / BigQuery adapters
- Provide minimal mapped SQL for v0.1 shapes.
- String literals are escaped in generated SQL (single quote
'becomes''). - Adapters are compile-focused and currently return
params: []; they do not emit prepared-statement placeholders. - This is a different safety contract than the Postgres reference compiler: safety here relies on escaping plus identifier checks, not bound-value placeholders.
- Review generated SQL and adapt JSON/time semantics before production rollout.
Smoke coverage
See packages/adapters/test/adapters.test.ts.