SQL Parser Coverage
Lexega includes dedicated parsers for four SQL dialects — Snowflake, PostgreSQL, BigQuery, and Databricks. All parsed statements undergo semantic extraction for governance signal emission (see Governance Rules for the full rule catalog).
Snowflake
DML (Data Manipulation)
- SELECT (including CTEs, recursive CTEs, window functions, PIVOT/UNPIVOT, MATCH_RECOGNIZE)
- INSERT (single/multi-value, subquery)
- INSERT ALL / INSERT FIRST (multi-table conditional insert)
- UPDATE (simple, multi-table)
- DELETE
- MERGE (with complex MATCHED/NOT MATCHED branches)
- COPY INTO (stage → table, table → stage)
- VALUES (standalone values queries)
- SET operations (UNION, UNION ALL, INTERSECT, EXCEPT, MINUS)
- Pipe syntax (SQL pipe chains)
DDL (Data Definition)
- CREATE/ALTER/DROP: TABLE, VIEW, MATERIALIZED VIEW
- CREATE/ALTER/DROP: STAGE, STREAM, TASK, PIPE
- CREATE/ALTER/DROP: DATABASE, SCHEMA
- CREATE/ALTER/DROP: DYNAMIC TABLE
- CREATE/ALTER/DROP: WAREHOUSE
- CREATE/ALTER/DROP: FUNCTION, TABLE FUNCTION, PROCEDURE
- CREATE EXTERNAL TABLE
- TRUNCATE, SHOW, DESCRIBE/DESC, USE
- UNDROP DATABASE, UNDROP SCHEMA, UNDROP TABLE
- GRANT / REVOKE
Security & Governance Policies
- CREATE/ALTER/DROP: MASKING POLICY
- CREATE/ALTER/DROP: ROW ACCESS POLICY
- DROP ALL ROW ACCESS POLICIES ON table
- CREATE/ALTER/DROP: NETWORK POLICY
- CREATE/ALTER/DROP: SESSION POLICY
- CREATE/ALTER/DROP: PASSWORD POLICY
- CREATE/ALTER/DROP: AGGREGATION POLICY
- CREATE/ALTER/DROP: PROJECTION POLICY
- CREATE/ALTER/DROP: AUTHENTICATION POLICY
Integrations
- CREATE/ALTER/DROP: STORAGE INTEGRATION
- CREATE/ALTER/DROP: API INTEGRATION
- CREATE/ALTER/DROP: EXTERNAL ACCESS INTEGRATION
Snowflake Scripting
- DECLARE, SET, LET
- IF / ELSEIF / ELSE, CASE statement
- FOR / WHILE / LOOP / REPEAT...UNTIL
- BREAK / CONTINUE
- BEGIN / END blocks with exception handling
- RETURN statements
- CALL (stored procedure invocation)
- Cursors (DECLARE CURSOR, LET CURSOR, OPEN, FETCH, CLOSE)
- EXECUTE IMMEDIATE (dynamic SQL)
- RAISE (exception raising)
- Transaction control (BEGIN TRANSACTION, COMMIT, ROLLBACK)
- Async job management (AWAIT, CANCEL)
Not yet supported: Standalone CREATE/ALTER FILE FORMAT. These statements are safely preserved during formatting but do not emit governance signals. File format options within COPY INTO and ALTER STAGE are fully parsed.
PostgreSQL
Full parsing and governance signal support for PostgreSQL-specific constructs.
DML
- SELECT, INSERT, UPDATE, DELETE, MERGE (PostgreSQL 15+)
- Common Table Expressions (WITH / WITH RECURSIVE)
- UPSERT via
INSERT ... ON CONFLICT DO NOTHING / DO UPDATE - COPY (TO / FROM with format options, including PROGRAM)
- VALUES (standalone)
DDL
- CREATE/ALTER/DROP TABLE (including
IF EXISTS,IF NOT EXISTS,CASCADE) - CREATE/ALTER/DROP INDEX (including
CONCURRENTLY, expression indexes) - CREATE/ALTER/DROP VIEW (including
CREATE OR REPLACE) - CREATE/ALTER/DROP SCHEMA
- CREATE/ALTER/DROP SEQUENCE (including
OWNED BY) - CREATE/ALTER/DROP TYPE (composite types, enums, ranges, domains)
- CREATE/ALTER/DROP DOMAIN (constraints, NOT NULL, defaults)
- CREATE/ALTER/DROP FUNCTION / PROCEDURE (including
LANGUAGE,RETURNS, body) - CREATE/ALTER/DROP TRIGGER (row-level, statement-level,
BEFORE/AFTER/INSTEAD OF) - CREATE/ALTER/DROP EXTENSION (including
CASCADE) - CREATE/ALTER/DROP TABLESPACE
- CREATE/ALTER/DROP RULE (query rewrite rules)
- CREATE AGGREGATE, CREATE OPERATOR
- COMMENT ON (tables, columns, functions, schemas, types, indexes, views)
- REFRESH MATERIALIZED VIEW (including
CONCURRENTLY)
Security & Access Control
- CREATE/ALTER/DROP ROLE (including
LOGIN,SUPERUSER,CREATEDB,CREATEROLE,INHERIT,REPLICATION,BYPASSRLS) - GRANT / REVOKE (table, schema, sequence, function privileges)
- Row Level Security:
CREATE POLICY,ALTER POLICY,DROP POLICY ALTER TABLE ... ENABLE/DISABLE ROW LEVEL SECURITYALTER TABLE ... FORCE/NO FORCE ROW LEVEL SECURITYALTER TABLE ... ENABLE/DISABLE TRIGGER- DROP OWNED, REASSIGN OWNED
Data Management
- TRUNCATE (with
CASCADE,RESTART IDENTITY) - VACUUM, ANALYZE
- CLUSTER, REINDEX
- LISTEN, NOTIFY, UNLISTEN
- LOCK TABLE (with lock modes)
- DISCARD (session state reset)
Transaction & Session Control
- BEGIN, COMMIT, ROLLBACK
- SET (session parameters)
- ALTER SYSTEM (server configuration)
- PREPARE, EXECUTE, DEALLOCATE
- EXPLAIN (with
ANALYZE,VERBOSE,FORMAT) - DO (anonymous code blocks)
Replication
- CREATE/ALTER PUBLICATION
- CREATE/ALTER SUBSCRIPTION
BigQuery
Full parsing and governance signal support for BigQuery-specific constructs.
DML
- SELECT, INSERT, UPDATE, DELETE, MERGE
- Common Table Expressions (WITH)
- ASSERT (with optional description)
DDL
- CREATE/ALTER/DROP TABLE, VIEW, SCHEMA
- CREATE/ALTER/DROP FUNCTION, PROCEDURE
- CREATE/DROP SNAPSHOT TABLE
- CREATE/DROP SEARCH INDEX
- CREATE/ALTER/DROP VECTOR INDEX
- CREATE EXTERNAL TABLE
Machine Learning (BQML)
- CREATE/ALTER/DROP MODEL
- EXPORT MODEL
Data Import/Export
- EXPORT DATA (with connection options)
- LOAD DATA (from external sources)
Databricks
Full parsing and governance signal support for Databricks / Delta Lake constructs.
DML
- SELECT, INSERT, UPDATE, DELETE, MERGE (with schema evolution)
- Common Table Expressions (WITH)
DDL
- CREATE/ALTER/DROP: TABLE, VIEW, SCHEMA
- CREATE/ALTER/DROP: CATALOG
- CREATE/ALTER/DROP: VOLUME
- CREATE/ALTER/DROP: EXTERNAL LOCATION
- CREATE/ALTER/DROP: STORAGE CREDENTIAL
- CREATE/ALTER/DROP: CONNECTION
- CREATE FLOW
- CACHE TABLE / UNCACHE TABLE
Delta Lake Operations
- OPTIMIZE (table compaction)
- DESCRIBE HISTORY (table history)
- REPAIR TABLE (partition metadata repair)
- RESTORE TABLE (time travel restore)
- Shallow clones (
CREATE TABLE ... SHALLOW CLONE)
Access Control
- GRANT / REVOKE (catalog, schema, volume, external location privileges)
- Ownership transfer via ALTER
Cross-Dialect Features
These features work across all supported dialects.
Expressions & Query Constructs
The expression parser is shared across all dialects and covers:
- Arithmetic, comparison, logical, and string operators
- CASE / IIF / COALESCE / NULLIF / TRY_CAST / CAST
- Subqueries (scalar, EXISTS, IN, ANY/ALL)
- Window functions (OVER, PARTITION BY, ORDER BY, frame specification)
- Aggregate functions (COUNT, SUM, AVG, etc. with DISTINCT, FILTER, WITHIN GROUP)
- BETWEEN, LIKE, ILIKE, SIMILAR TO, RLIKE
- ARRAY / OBJECT / STRUCT constructors
- Semi-structured access (dot notation, bracket notation,
::casting) - LATERAL, FLATTEN, TABLE functions
- Qualified names (schema.table.column)
- INTERVAL, AT TIME ZONE
Need Help?
Can't find what you're looking for? Check out our GitHub or reach out to support.