sqlscope

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sqlscope finds SQL statements that touch a pipeline-scoped table without naming pipeline_id, or a run-scoped one (run_id REFERENCES runs, no pipeline_id of its own) without naming pipeline_id or reaching runs. It lives in tools/ because it reads source, and its test is what holds each driver in internal/store to the rule CLAUDE.md states in prose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Pos   string
	Table string
	SQL   string
}

Finding is one statement on a scoped table that names no pipeline.

type Report

type Report struct {
	Findings   []Finding
	Tables     int
	RunTables  int
	Statements int
}

Report is what a directory's source says: the findings, and how much was read — so a caller can tell "nothing wrong" from "nothing parsed".

func Check

func Check(dir string) (Report, error)

Check reads every non-test Go file in dir. The scoped tables come from the CREATE TABLE statements found there rather than from a list, so a new table is held to the rule the day it is created.

ponytail: "names pipeline_id somewhere", not "scopes every table it touches" — a join of two scoped tables with one predicate passes, and so does a statement whose only mention sits in a shared subquery. Upgrade to a real SQL parser if a review ever finds one of those; every unscoped statement found so far named it nowhere.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL