Help us shape the future of Go! Take the 2026 Go Developer Survey

sqltables

package
v1.130.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package sqltables extracts the physical tables a SQL statement reads.

It is one extractor, not one per caller: semantic enrichment names the tables it must fetch context for, and the call catalog names the datasets a recorded query addressed (#1321). Both are answering the same question, and a second implementation of it would mean an enriched table and a cataloged target disagreeing about what a query touched.

The extraction is lexical (regular expressions over FROM and JOIN clauses, plus Trino's Elasticsearch raw_query table function), not a parser: it names what a statement plainly reads, drops common table expressions, and makes no claim about a statement it cannot parse.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ref

type Ref struct {
	Catalog  string
	Schema   string
	Table    string
	FullPath string
	Source   string // "FROM", "JOIN", "TABLE_FUNCTION"
}

Ref is one table a statement reads.

func Extract

func Extract(sql string) []Ref

Extract returns every physical table a statement reads. Uses regex for Trino-specific functions and standard table patterns. Combines ES raw_query indices with regular table references (e.g., JOINs). Filters out CTE references to only return physical tables.

Jump to

Keyboard shortcuts

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