DBQC Compile Checking in CI

Every DBQC client library includes a check mode that compiles all queries against the DBQC compiler endpoint and exits non-zero on any failure. Use this as a build gate to catch invalid queries (bad column names, type mismatches, missing tables) at build time, not at runtime.

This carries the same compiler feedback available during development into the delivery pipeline. It checks definitions and generated SQL; it does not connect to the application database or execute the statements under test.

A large query graph passes through a validation gateway that captures risky changes before a controlled database deployment.

Prerequisites

Set DBQC_ENDPOINT to a reachable compile endpoint:

export DBQC_ENDPOINT=http://localhost:8080/api/dbqc/compile

The deployed endpoint (https://app.volvwealth.com/api/dbqc/compile) is auth-gated; use a local dev server for CI.

One-liners per language

Python

python3 server/core/dbqc/experiments/client/dbqc.py check --target psql

TypeScript

node --experimental-strip-types server/core/dbqc/experiments/client/dbqc.ts check --target psql

Java

java server/core/dbqc/experiments/client/Dbqc.java check --target postgres

Scala (in-process, no endpoint needed)

cd server && JAVA_HOME=/opt/homebrew/Cellar/openjdk@17/17.0.18/libexec/openjdk.jdk/Contents/Home \
  bleep run dbqc-check

Or from Scala code:

import com.volvwealth.dbqc.impl.Compiler
// Throws RuntimeException on any compile error
Compiler.compileOrFail(myQuery)

Rust

cd server/core/dbqc/experiments/client/dbqc-rs && cargo run --bin dbqc-cli -- check --target psql

GitHub Actions

name: DBQC Compile Check
on: [push, pull_request]

jobs:
  dbqc-check:
    runs-on: ubuntu-latest
    services:
      dbqc:
        image: volv-server:latest
        ports:
          - 8080:8080
    env:
      DBQC_ENDPOINT: http://localhost:8080/api/dbqc/compile
    steps:
      - uses: actions/checkout@v4
      - name: Check Python queries
        run: python3 server/core/dbqc/experiments/client/dbqc.py check
      - name: Check TypeScript queries
        run: node --experimental-strip-types server/core/dbqc/experiments/client/dbqc.ts check
      - name: Check Java queries
        run: java server/core/dbqc/experiments/client/Dbqc.java check

Makefile

.PHONY: dbqc-check
dbqc-check:
	python3 server/core/dbqc/experiments/client/dbqc.py check --target psql
	node --experimental-strip-types server/core/dbqc/experiments/client/dbqc.ts check --target psql
	java server/core/dbqc/experiments/client/Dbqc.java check --target psql
	cd server/core/dbqc/experiments/client/dbqc-rs && cargo run --bin dbqc-cli -- check --target psql

Pre-commit hook

Add to .git/hooks/pre-commit (or use the policy/ hook framework):

#!/bin/bash
set -e

if [ -n "$DBQC_ENDPOINT" ]; then
  echo "DBQC compile check..."
  python3 server/core/dbqc/experiments/client/dbqc.py check --target psql
fi

Adding your own queries

Each client's check mode compiles the built-in sample queries by default. To check your own queries, use the Compiler.check() / Dbqc.check() / check() API directly:

Python

from dbqc import Table, col, Compiler

users = Table("users", {"id": "uuid", "name": "text"})
my_query = users.select(name=col(users, "name", "text"))

Compiler.check([("my_query", my_query)], target="psql")

TypeScript

import { table, col, Compiler } from "./dbqc.ts";

const users = table("users", { id: "uuid", name: "text" });
const myQuery = users.select({ name: col(users, "name", "text") });

await Compiler.check([["my_query", myQuery]], "psql");

Java

Dbqc.Source users = Dbqc.table("users", Dbqc.mapOfStr("id", "uuid", "name", "text"));
Dbqc.Source myQuery = users.select(Dbqc.exprs("name", Dbqc.col(users, "name", "text")));

Dbqc.check(List.of(Map.entry("my_query", myQuery)), "psql", Dbqc.DEFAULT_ENDPOINT);

Rust

use dbqc::*;

let users = table("users", &[("id", "uuid"), ("name", "text")], "public", &[]);
let my_query = users.select(&[("name", col(&users, "name", "text"))]);

check(&[("my_query", &my_query, "psql")], &default_endpoint()).unwrap();

Scala (in-process)

import com.volvwealth.dbqc.impl.Compiler

// Throws on failure — use in tests or build plugins
val compiled = Compiler.compileOrFail(myQuery)