mysql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package mysql provides direct lineage analysis for MySQL queries.

This implementation is built on github.com/bytebase/omni's MySQL parser and typed AST. It replaces the legacy ANTLR implementation, which was parity-verified against it over the golden corpus and then removed.

Known gaps and their intended resolution are tracked in .agents/docs/lineage-semantics.md; defects in omni itself are recorded in .agents/docs/omni-upstream-defects.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyze

func Analyze(ctx context.Context, sql string, cat catalog.Provide) ([]model.ColumnRelation, error)

Analyze parses a single MySQL statement and returns its column relations.

func Registration

func Registration() lineage.EngineRegistration

Registration binds MySQL to the analyzer this package provides. The process assembles the registered engines where it is built, so this package does not register itself into package state.

MariaDB and TiDB live in their own packages and provide their own analyzers. OceanBase is deliberately unsupported: the runner records a per-object skip for it.

func SplitStatements

func SplitStatements(sql string) []string

SplitStatements splits a script into its individual statements, dropping the ones that carry no SQL. The caller feeds them to Analyze one at a time: this analyzer is defined for exactly one statement.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer performs direct lineage analysis on MySQL queries.

func NewAnalyzer

func NewAnalyzer(ctx context.Context, sql string, catalogProvide catalog.Provide) *Analyzer

NewAnalyzer creates a new MySQL lineage analyzer.

func (*Analyzer) AnalyzeRelations

func (a *Analyzer) AnalyzeRelations() ([]model.ColumnRelation, error)

AnalyzeRelations parses the SQL and returns column relations.

Parsing is strict: a statement omni cannot parse is an error, never a partial result. Multi-statement input is rejected because the analyzer is defined for exactly one statement; the caller splits a script and analyzes it statement by statement. A statement shape the analyzer cannot represent is reported as a gap beside the edges it found, never as a silent empty result.

Directories

Path Synopsis
Command gen copies the shared MySQL-family analyzer body into the TiDB and MariaDB packages.
Command gen copies the shared MySQL-family analyzer body into the TiDB and MariaDB packages.

Jump to

Keyboard shortcuts

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