SQL Dialects
sql-splitter supports four SQL dialects.
Source: mysqldump
Detection signals:
MySQL dump/MariaDB dumpheader comment- Conditional comments (
/*!40...,/*!50...) LOCK TABLES- Backtick quoting (
`table`)
Features supported:
CREATE TABLEwith inline keysINSERT INTO(single and multi-row)CREATE INDEXALTER TABLE- Session commands (
SET,USE) are recognized but carry no table, sosplitdoes not write them to any output file
Example:
CREATE TABLE `users` (`id` INT AUTO_INCREMENT PRIMARY KEY,`name` VARCHAR(100) NOT NULL,`email` VARCHAR(255),INDEX `idx_email` (`email`)) ENGINE=InnoDB;
INSERT INTO `users` VALUES (1, 'Alice', 'alice@example.com');Source: pg_dump (plain text format)
Detection signals:
pg_dump/PostgreSQL database dumpheader commentCOPY ... FROM stdinsearch_path- Dollar quoting (
$$) andCREATE EXTENSION
Features supported:
CREATE TABLECOPY ... FROM stdin(tab-separated data)INSERT INTOCREATE INDEXALTER TABLE- Sequences (
CREATE SEQUENCE) are recognized but carry no table, sosplitdoes not write them to any output file
Example:
CREATE TABLE users (id SERIAL PRIMARY KEY,name VARCHAR(100) NOT NULL,email VARCHAR(255));
COPY users (id, name, email) FROM stdin;1 Alice alice@example.com2 Bob bob@example.com\.Note: Binary/custom pg_dump formats are not supported. Use pg_dump -Fp (plain).
Source: .dump command
Detection signals:
SQLiteheader commentPRAGMAstatementsBEGIN TRANSACTION
Features supported:
CREATE TABLEINSERT INTOCREATE INDEXPRAGMAstatements are recognized but carry no table, sosplitdoes not write them to any output file
Example:
CREATE TABLE users (id INTEGER PRIMARY KEY,name TEXT NOT NULL,email TEXT);
INSERT INTO users VALUES (1, 'Alice', 'alice@example.com');Source: sqlcmd, SSMS Generate Scripts
Detection signals:
SET ANSI_NULLS,SET QUOTED_IDENTIFIERGObatch separatorIDENTITY(- Square bracket quoting (
[table]) NVARCHAR,N'...'literals
Features supported:
CREATE TABLEINSERT INTOCREATE INDEXGObatch handling
Example:
CREATE TABLE [users] ([id] INT IDENTITY(1,1) PRIMARY KEY,[name] NVARCHAR(100) NOT NULL,[email] NVARCHAR(255));GO
INSERT INTO [users] ([name], [email]) VALUES (N'Alice', N'alice@example.com');GOAuto-Detection
Section titled Auto-Detectionsql-splitter scores dialect markers in the first 8 KB of the file. Ambiguous files default to MySQL. Override with --dialect:
sql-splitter split dump.sql --dialect=postgressql-splitter convert dump.sql --from mysql --to postgresDetection can guess wrong when marker-like text appears in data or comments early in the file see Known Limitations for the failure modes, plus what each dialect parser does not handle (stored procedures, binary formats, and more).