SqlValidator

A utility object that provides functionality for SQL validation and schema handling. This includes methods for checking SQL query syntax, validating against schemas, managing schemas from definition files, and ensuring data type consistency during validation.

Types

Link copied to clipboard
data class ColumnDef(val name: String, val type: String)
Link copied to clipboard
data class MigrationTable(columns: List<SqlValidator.ColumnDef>) : AbstractTable
Link copied to clipboard
data class TableDef(val name: String, val columns: MutableList<SqlValidator.ColumnDef>)

Functions

Link copied to clipboard
fun loadSchema(path: String)

Loads SQL schema definitions from the specified directory, processes each .sql file encountered, and constructs a representation of the database schema consisting of tables and their columns.

Link copied to clipboard

Validates the provided SQL query schema against Calcite's SQL parser and validator. Optionally applies custom literal type checks if the VALIDATE_LITERAL_TYPES flag is enabled.

Link copied to clipboard

Validates the syntax of an SQL query by attempting to parse it. If the SQL syntax is invalid, an error is thrown with a message indicating the issue.