### Install Zsh completions Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Installation procedures for Zsh, including standard fpath setup, Oh-My-Zsh, and manual fpath configuration. ```bash echo $fpath | tr ' ' '\n' ``` ```bash # Use the first writable fpath directory (usually ~/.zsh/completions or similar) sql-splitter completions zsh > "${fpath[1]}/_sql-splitter" # Rebuild completion cache and reload autoload -Uz compinit && compinit source ~/.zshrc ``` ```bash # Oh-My-Zsh includes ~/.oh-my-zsh/completions in fpath mkdir -p ~/.oh-my-zsh/completions sql-splitter completions zsh > ~/.oh-my-zsh/completions/_sql-splitter # Reload source ~/.zshrc ``` ```bash # Create one and add to fpath in .zshrc mkdir -p ~/.zsh/completions echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc sql-splitter completions zsh > ~/.zsh/completions/_sql-splitter source ~/.zshrc ``` -------------------------------- ### Install man pages manually Source: https://github.com/helgesverre/sql-splitter/blob/main/README.md Install documentation pages after a cargo installation. ```bash git clone https://github.com/helgesverre/sql-splitter cd sql-splitter make install-man ``` -------------------------------- ### Install sql-splitter Source: https://github.com/helgesverre/sql-splitter/blob/main/website/index.html Installation methods via crates.io, GitHub, or manual source compilation. ```bash cargo install sql-splitter ``` ```bash cargo install --git https://github.com/helgesverre/sql-splitter ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git cd sql-splitter cargo build --release sudo cp target/release/sql-splitter /usr/local/bin/ ``` -------------------------------- ### Install and Render Graphviz Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/graph.mdx Instructions for installing Graphviz and performing manual rendering. ```bash # Install Graphviz brew install graphviz # macOS apt install graphviz # Ubuntu/Debian # Render DOT to PNG sql-splitter graph dump.sql -o schema.dot dot -Tpng schema.dot -o schema.png # Or use --render (requires Graphviz installed) sql-splitter graph dump.sql -o schema.png --render ``` -------------------------------- ### Install via Shell Script Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/getting-started/installation.mdx Downloads and installs the pre-built binary for macOS and Linux to $CARGO_HOME/bin or $HOME/.cargo/bin. ```bash curl -fsSL https://sql-splitter.dev/install.sh | sh ``` -------------------------------- ### Install C compiler for build Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/advanced/troubleshooting.mdx Install build-essential or gcc to resolve linker errors during installation. ```bash # Ubuntu/Debian sudo apt-get install build-essential # Fedora/RHEL sudo dnf install gcc # Then retry cargo install sql-splitter ``` -------------------------------- ### Install from source Source: https://github.com/helgesverre/sql-splitter/blob/main/README.md Clone the repository and build the binary with make. ```bash git clone https://github.com/helgesverre/sql-splitter cd sql-splitter make install # Installs binary + shell completions + man pages ``` -------------------------------- ### Basic Merge Examples Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/merge.mdx Examples for performing a standard merge or a dry-run preview. ```bash # Merge all tables from a directory sql-splitter merge tables/ -o restored.sql # Preview what would be merged (no files written) sql-splitter merge tables/ --dry-run ``` -------------------------------- ### Define example schema Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/cookbook/multi-tenant.mdx Example SQL schema showing global and tenant-specific tables. ```sql -- Global tables (no tenant_id) CREATE TABLE countries (id INT PRIMARY KEY, name VARCHAR(100)); CREATE TABLE currencies (id INT PRIMARY KEY, code VARCHAR(3)); -- Tenant tables CREATE TABLE tenants (id INT PRIMARY KEY, name VARCHAR(100)); CREATE TABLE users ( id INT PRIMARY KEY, tenant_id INT REFERENCES tenants(id), name VARCHAR(100) ); CREATE TABLE orders ( id INT PRIMARY KEY, tenant_id INT REFERENCES tenants(id), user_id INT REFERENCES users(id) ); ``` -------------------------------- ### System-wide Completion Installation Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Command to install completions with elevated permissions. ```bash sudo sql-splitter completions bash > /etc/bash_completion.d/sql-splitter ``` -------------------------------- ### Manual Database Setup Workaround Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DUCKDB_INTEGRATION_DEEP_DIVE.md Traditional method requiring a full PostgreSQL server setup to query SQL dumps. ```bash createdb tempdb psql tempdb < dump.sql psql tempdb -c "SELECT COUNT(*) FROM users" dropdb tempdb ``` -------------------------------- ### CI/CD Integration Examples Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/diff.mdx Examples for using JSON output to gate CI pipelines or export diff results. ```bash # Fail CI if any schema differences exist (exit code is 0 either way, # so check the JSON summary instead) sql-splitter diff production.sql staging.sql --schema-only --format json \ | jq -e '.summary.tables_added + .summary.tables_removed + .summary.tables_modified == 0' # Export diff as JSON for further processing sql-splitter diff old.sql new.sql --format json -o diff.json ``` -------------------------------- ### Install via PowerShell Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/getting-started/installation.mdx Installs the package on Windows using PowerShell. ```powershell powershell -ExecutionPolicy Bypass -c "irm https://sql-splitter.dev/install.ps1 | iex" ``` -------------------------------- ### Basic Comparison Examples Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/diff.mdx Examples for comparing schema and data, or restricting the comparison to one or the other. ```bash # Compare two dumps (schema + data) sql-splitter diff old.sql new.sql # Schema-only comparison (faster, no data loading) sql-splitter diff old.sql new.sql --schema-only # Data-only comparison (assumes schema is identical) sql-splitter diff old.sql new.sql --data-only ``` -------------------------------- ### Verify installation Source: https://github.com/helgesverre/sql-splitter/blob/main/website/index.html Check the installed version of the tool. ```bash sql-splitter --version ``` -------------------------------- ### Install Rust Source: https://github.com/helgesverre/sql-splitter/blob/main/CONTRIBUTING.md Command to install the Rust toolchain via rustup. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Installation Command Source: https://github.com/helgesverre/sql-splitter/blob/main/website/og-image.html Shell command to install sql-splitter via a script. ```bash $ curl -fsSL https://sql-splitter.dev/install.sh | sh ``` -------------------------------- ### Install PowerShell completions Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Installation procedure for PowerShell by appending the completion script to the user profile. ```powershell echo $PROFILE # Typically: ~/.config/powershell/Microsoft.PowerShell_profile.ps1 (Linux/macOS) # Or: ~/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 (Windows) ``` ```powershell # Create profile if it doesn't exist if (!(Test-Path -Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force } # Append completions to profile sql-splitter completions powershell >> $PROFILE # Reload profile . $PROFILE ``` -------------------------------- ### Install Bash completions Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Methods for installing Bash completions system-wide or for the current user. ```bash sudo sql-splitter completions bash > /etc/bash_completion.d/sql-splitter ``` ```bash # Create completions directory if needed mkdir -p ~/.bash_completion.d # Generate completions sql-splitter completions bash > ~/.bash_completion.d/sql-splitter # Add to .bashrc (one-time setup) echo 'source ~/.bash_completion.d/sql-splitter' >> ~/.bashrc # Reload current session source ~/.bashrc ``` -------------------------------- ### Install sql-splitter via Cargo Source: https://github.com/helgesverre/sql-splitter/blob/main/README.md Install the binary directly from crates.io. ```bash cargo install sql-splitter ``` -------------------------------- ### PostgreSQL Example Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/reference/dialects.mdx Example of a PostgreSQL plain text dump using COPY FROM stdin. ```sql 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.com 2 Bob bob@example.com \. ``` -------------------------------- ### Verify sql-splitter installation Source: https://github.com/helgesverre/sql-splitter/blob/main/website/llms.txt Check the installed version of the tool. ```bash sql-splitter --version # sql-splitter 1.15.0 ``` -------------------------------- ### Install sql-splitter skill in Letta Source: https://github.com/helgesverre/sql-splitter/blob/main/website/llms.txt Clone the repository and copy the skill directory to the local .skills directory. ```bash # Copy to project's Letta skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .skills/ ``` -------------------------------- ### Input SQL Dump Example Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DBT_INTEGRATION_DEEP_DIVE.md Example source SQL dump containing table definitions for users and orders. ```sql -- MySQL dump CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, email VARCHAR(255) NOT NULL UNIQUE, status ENUM('active', 'inactive') DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, COMMENT 'User accounts' ); CREATE TABLE orders ( id INT AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, total DECIMAL(10,2) NOT NULL CHECK (total > 0), status VARCHAR(20) CHECK (status IN ('pending', 'completed', 'cancelled')), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ); ``` -------------------------------- ### Install Fish completions Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Installation procedure for Fish shell, which automatically loads files from the completions directory. ```bash # Create directory if needed mkdir -p ~/.config/fish/completions # Generate completions (takes effect immediately in new shells) sql-splitter completions fish > ~/.config/fish/completions/sql-splitter.fish ``` -------------------------------- ### Install via Homebrew Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/getting-started/installation.mdx Installs the package using the Homebrew package manager. ```bash brew install helgesverre/tap/sql-splitter ``` -------------------------------- ### Verify installation Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/advanced/troubleshooting.mdx Check if the sql-splitter binary is correctly located in your PATH. ```bash which sql-splitter # Should output: /Users/you/.cargo/bin/sql-splitter ``` -------------------------------- ### Conversion Examples Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/convert.mdx Common conversion scenarios between MySQL, PostgreSQL, and SQLite. ```bash # MySQL to PostgreSQL sql-splitter convert mysql.sql --to postgres -o pg.sql # PostgreSQL to MySQL (COPY blocks become INSERT statements) sql-splitter convert pg_dump.sql --to mysql -o mysql.sql # Any dialect to SQLite (great for local development) sql-splitter convert dump.sql --to sqlite -o sqlite.sql ``` -------------------------------- ### Install sql-splitter skill via npx Source: https://github.com/helgesverre/sql-splitter/blob/main/website/llms.txt Use the universal npx installer to add the skill to supported agents. ```bash # Works with Claude Code, Cursor, Amp, VS Code, Goose, OpenCode npx ai-agent-skills install sql-splitter --agent claude npx ai-agent-skills install sql-splitter --agent cursor npx ai-agent-skills install sql-splitter --agent amp npx ai-agent-skills install sql-splitter --agent vscode npx ai-agent-skills install sql-splitter --agent goose npx ai-agent-skills install sql-splitter --agent opencode ``` -------------------------------- ### SQLite Example Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/reference/dialects.mdx Example of an SQLite dump generated via the .dump command. ```sql CREATE TABLE users ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT ); INSERT INTO users VALUES (1, 'Alice', 'alice@example.com'); ``` -------------------------------- ### Example profiling output Source: https://github.com/helgesverre/sql-splitter/blob/main/AGENTS.md Sample output showing performance metrics for various sql-splitter commands. ```text Command Dialect File Size Peak RSS Wall Time Extra Args ------------------------------------------------------------ analyze mysql 123.72 MB 6.85 MB 0:00.28 split mysql 123.72 MB 9.93 MB 0:00.31 validate mysql 123.72 MB 81.65 MB 0:01.50 validate mysql 123.72 MB 9.60 MB 0:00.28 --no-fk-checks sample mysql 123.72 MB 15.90 MB 0:02.03 diff mysql 123.72 MB 131.48 MB 0:02.98 redact mysql 123.72 MB 9.09 MB 0:00.66 graph mysql 123.72 MB 8.59 MB 0:00.31 order mysql 123.72 MB 140.85 MB 0:00.41 query mysql 123.72 MB 99.89 MB 0:36.51 shard mysql 123.72 MB 5.65 MB 0:00.01 convert mysql 123.72 MB 12.26 MB 0:00.84 ``` -------------------------------- ### Install GNU time prerequisites Source: https://github.com/helgesverre/sql-splitter/blob/main/AGENTS.md Install the necessary time utility for memory profiling on macOS or Linux. ```bash # macOS: Install GNU time brew install gnu-time # Linux: GNU time is typically at /usr/bin/time ``` -------------------------------- ### Update llms.txt Example Source: https://github.com/helgesverre/sql-splitter/blob/main/AGENTS.md Example of documenting a new CLI flag within the llms.txt file structure. ```markdown ## Commands ### split ... Options: - `--format `: Output format: sql, json (default: sql) # ADD THIS ... ``` -------------------------------- ### Install Shell Completions Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/getting-started/installation.mdx Manually installs shell completion scripts for Bash, Zsh, or Fish. ```bash # Bash (user) sql-splitter completions bash >> ~/.bashrc # Zsh (oh-my-zsh) sql-splitter completions zsh > ~/.oh-my-zsh/completions/_sql-splitter # Fish sql-splitter completions fish > ~/.config/fish/completions/sql-splitter.fish ``` -------------------------------- ### MSSQL Example Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/reference/dialects.mdx Example of an MSSQL script using square bracket quoting and GO batch separators. ```sql 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'); GO ``` -------------------------------- ### Create a SQL test fixture Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/contributing/testing.mdx Example SQL file content for testing new features. ```sql -- tests/fixtures/static/mysql/my_feature.sql CREATE TABLE test ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) ); INSERT INTO test VALUES (1, 'Alice'); INSERT INTO test VALUES (2, 'Bob'); ``` -------------------------------- ### Basic Splitting Operations Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/split.mdx Examples for standard file splitting and dry-run previewing. ```bash # Split all tables to output/ sql-splitter split database.sql --output=tables/ # Preview what would be created (no files written) sql-splitter split database.sql --dry-run --verbose ``` -------------------------------- ### Install Agent Skill Source: https://github.com/helgesverre/sql-splitter/blob/main/AGENTS.md Commands to install the sql-splitter skill for various AI coding assistants. ```bash amp skill add helgesverre/sql-splitter ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.claude/skills/ ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .github/skills/ ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .cursor/skills/ ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.config/goose/skills/ ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .skills/ ``` ```bash git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.opencode/skills/ ``` ```bash npx ai-agent-skills install sql-splitter --agent # Supported agents: claude, cursor, amp, vscode, goose, opencode ``` -------------------------------- ### Install sql-splitter skill in OpenCode Source: https://github.com/helgesverre/sql-splitter/blob/main/website/llms.txt Clone the repository and copy the skill directory to the OpenCode configuration directory. ```bash # Copy to OpenCode skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.opencode/skills/ ``` -------------------------------- ### MySQL Example Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/reference/dialects.mdx Example of a MySQL dump structure using backtick quoting and ENGINE definitions. ```sql 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'); ``` -------------------------------- ### Browse schema interactively Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/INTEGRATION_OPPORTUNITIES.md Start a local web server to explore the schema interactively in a browser. ```bash # Generate interactive schema browser sql-splitter browse dump.sql # Starts local web server on :8080 # Interactive schema exploration in browser # - Click tables to see columns # - Highlight FK relationships # - Search across schema ``` -------------------------------- ### Install shell completions via Makefile Source: https://github.com/helgesverre/sql-splitter/blob/main/README.md Use the provided Makefile to install completions for the current shell or all supported shells. ```bash # Install for current shell only make install-completions # Install for all shells (bash, zsh, fish) make install-completions-all ``` -------------------------------- ### Infer command usage examples Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/SCHEMA_INFERENCE.md Various command-line interface examples for inferring schema from different data sources and formats. ```bash # Infer schema from INSERT-only dump sql-splitter infer data.sql -o schema.sql # Infer from CSV sql-splitter infer data.csv --table users --dialect mysql # Generate both schema and data sql-splitter infer data.csv -o complete.sql --with-data # Specify output dialect sql-splitter infer data.sql --dialect postgres -o schema.sql # Show inferred schema without writing sql-splitter infer data.sql --dry-run # Infer with hints sql-splitter infer data.sql --primary-key id --index email # Sample mode (analyze first N rows only) sql-splitter infer huge.sql --sample 10000 -o schema.sql # JSON output for programmatic use sql-splitter infer data.sql --format json ``` -------------------------------- ### Advanced Glob Pattern Examples Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/advanced/glob-patterns.mdx Additional examples for matching specific file patterns and recursive file sets. ```bash # All .sql files in dumps/ sql-splitter analyze "dumps/*.sql" # All .sql and .sql.gz files recursively sql-splitter validate "backups/**/*.sql*" # Files starting with "prod_" sql-splitter analyze "prod_*.sql" # Files from 2024 sql-splitter validate "backup_2024*.sql" ``` -------------------------------- ### Install Xcode command line tools Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/advanced/troubleshooting.mdx Required for building on Apple Silicon systems. ```bash xcode-select --install ``` -------------------------------- ### Sample then query Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/sample.mdx Create a subset of the database and execute ad-hoc queries against the resulting file. ```bash # Create sample, then run ad-hoc queries against it sql-splitter sample dump.sql --percent 5 --preserve-relations -o sample.sql sql-splitter query sample.sql "SELECT COUNT(*) FROM users" ``` -------------------------------- ### Clone and build the project Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/contributing/development.mdx Initial setup commands to clone the repository and compile the project using Cargo. ```bash git clone https://github.com/helgesverre/sql-splitter cd sql-splitter cargo build ``` -------------------------------- ### Install sql-splitter skill in Goose Source: https://github.com/helgesverre/sql-splitter/blob/main/website/llms.txt Clone the repository and copy the skill directory to the Goose configuration directory. ```bash # Copy to Goose skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.config/goose/skills/ ``` -------------------------------- ### Visualize dependencies and sample Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/sample.mdx Generate a dependency graph to identify root tables before performing a targeted sample. ```bash # Understand the FK graph before deciding on root tables sql-splitter graph dump.sql --format mermaid -o schema.md sql-splitter sample dump.sql --percent 10 --preserve-relations --root-tables users,orgs -o dev.sql ``` -------------------------------- ### Build and test the project Source: https://github.com/helgesverre/sql-splitter/blob/main/CONTRIBUTING.md Standard commands to compile the project and run the test suite. ```bash cargo build --release cargo test ``` -------------------------------- ### Bootstrap a new dbt project Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DBT_INTEGRATION_DEEP_DIVE.md Initialize a dbt project from an existing production database dump to immediately generate staging models and documentation. ```bash # Existing production database pg_dump production > prod_dump.sql # Generate dbt project sql-splitter dbt-init prod_dump.sql -o dbt_project/ # Immediate value cd dbt_project/ dbt run # All staging models built dbt test # 100+ tests pass dbt docs generate # Full documentation # Team can now focus on marts layer (business logic) ``` -------------------------------- ### Basic Usage Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/sample.mdx General syntax for the sample command. ```bash sql-splitter sample [OPTIONS] ``` -------------------------------- ### Executing Basic Queries Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/query.mdx Examples of running standard SQL queries like counts, filters, and joins against a dump file. ```bash # Count rows in a table sql-splitter query dump.sql "SELECT COUNT(*) FROM users" # Filter and inspect data sql-splitter query dump.sql "SELECT * FROM orders WHERE total > 100" # Join across tables sql-splitter query dump.sql "SELECT u.name, COUNT(o.id) FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.name" ``` -------------------------------- ### Verify Completion Installation Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Command to test if shell completions are correctly installed and active. ```bash # Type and press Tab sql-splitter # Should show all commands: # analyze completions convert diff graph merge order query redact sample shard split validate ``` -------------------------------- ### CLI Options for dbt-init Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DBT_INTEGRATION_DEEP_DIVE.md Configuration flags available for the dbt-init command. ```text --output, -o Output directory for dbt project --name Project name (default: inferred from dump filename) --profile dbt profile name (default: "postgres") --schema Source schema name (default: "raw") --database Source database name (default: inferred) --tables Filter to specific tables (comma-separated) --with-marts Generate example marts layer models --staging-prefix Prefix for staging models (default: "stg_") --docs Generate extended documentation ``` -------------------------------- ### Command Interface Examples for sql-splitter migrate Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/MIGRATE_FEATURE.md Various command-line usage patterns for generating migrations, rollbacks, and handling specific schema scenarios. ```bash # Generate migration from schema diff sql-splitter migrate old.sql new.sql -o migration.sql # Generate with rollback script sql-splitter migrate old.sql new.sql -o migration.sql --rollback rollback.sql # Check for breaking changes only sql-splitter migrate old.sql new.sql --breaking-changes # Dry run (show migration without writing) sql-splitter migrate old.sql new.sql --dry-run # Generate for specific dialect sql-splitter migrate old.sql new.sql -o migration.sql --dialect postgres # Generate data migration helpers sql-splitter migrate old.sql new.sql -o migration.sql --with-data # Split into multiple migration files sql-splitter migrate old.sql new.sql -o migrations/ --split # Generate only for specific tables sql-splitter migrate old.sql new.sql --tables "users,orders" ``` -------------------------------- ### Clone the repository Source: https://github.com/helgesverre/sql-splitter/blob/main/CONTRIBUTING.md Initial steps to download the project source code. ```bash git clone https://github.com/helgesverre/sql-splitter.git cd sql-splitter ``` -------------------------------- ### Build from Source Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/getting-started/installation.mdx Compiles the binary, shell completions, and man pages from the repository. ```bash git clone https://github.com/helgesverre/sql-splitter cd sql-splitter make install # Installs binary + shell completions + man pages ``` ```bash cargo install --git https://github.com/helgesverre/sql-splitter ``` -------------------------------- ### Type Conversion Bottleneck Examples Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/PARALLEL_ALL_COMMANDS_ANALYSIS.md Illustrative examples of computational type conversion operations that cause CPU bottlenecks. ```rust // Each conversion is computational "VARCHAR(255)" → "TEXT" // String matching "AUTO_INCREMENT" → "SERIAL" // Pattern replacement "DATETIME" → "TIMESTAMP" // Type mapping "COPY ... FROM stdin" → "INSERT ..." // Complex parsing + rebuilding ``` -------------------------------- ### Build and run a custom sql-splitter image Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/cookbook/docker-usage.mdx Clone the repository and build an optimized Docker image using a multi-stage build process. ```bash # Clone and build git clone https://github.com/helgesverre/sql-splitter cd sql-splitter # Build optimized image docker build -t sql-splitter -f - . <<'EOF' FROM rust:slim AS builder WORKDIR /app COPY . . RUN cargo build --release FROM debian:bookworm-slim COPY --from=builder /app/target/release/sql-splitter /usr/local/bin/ ENTRYPOINT ["sql-splitter"] EOF # Run docker run --rm -v $(pwd):/data sql-splitter analyze /data/dump.sql ``` -------------------------------- ### Setting up output directory Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/split.mdx Ensure the output directory exists and has the correct permissions before running the split command. ```bash mkdir -p tables/ sql-splitter split dump.sql -o tables/ ``` -------------------------------- ### Install sql-splitter manually for AI tools Source: https://github.com/helgesverre/sql-splitter/blob/main/website/public/llms.txt Clone the repository and copy the skill directory to the specific configuration path required by your AI tool. ```bash # Clone and copy to Claude Code skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.claude/skills/ ``` ```bash # Copy to project's GitHub skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .github/skills/ ``` ```bash # Copy to project's Cursor skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .cursor/skills/ ``` ```bash # Copy to Goose skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.config/goose/skills/ ``` ```bash # Copy to project's Letta skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .skills/ ``` ```bash # Copy to OpenCode skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter ~/.opencode/skills/ ``` -------------------------------- ### Output Formats Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/query.mdx Examples of supported output formats for query results. ```text ┌────┬─────────┬─────────────────────┐ │ id │ name │ email │ ├────┼─────────┼─────────────────────┤ │ 1 │ Alice │ alice@example.com │ │ 2 │ Bob │ bob@example.com │ └────┴─────────┴─────────────────────┘ ``` ```json [ { "id": 1, "name": "Alice", "email": "alice@example.com" }, { "id": 2, "name": "Bob", "email": "bob@example.com" } ] ``` ```csv id,name,email 1,Alice,alice@example.com 2,Bob,bob@example.com ``` -------------------------------- ### Convert SQL Dialects via Agent Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/advanced/ai-integration.mdx Example prompt and commands for converting MySQL dumps to PostgreSQL. ```bash sql-splitter validate mysql_dump.sql --strict sql-splitter convert mysql_dump.sql --to postgres -o postgres_dump.sql --progress sql-splitter validate postgres_dump.sql --dialect postgres --strict ``` -------------------------------- ### CI/CD Integration Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/advanced/glob-patterns.mdx Example of using sql-splitter in a GitHub Actions workflow. ```yaml # GitHub Actions example - name: Validate all SQL dumps run: | sql-splitter validate "migrations/*.sql" --strict --json > validation.json if jq -e '.failed > 0' validation.json; then echo "Validation failed" exit 1 fi ``` -------------------------------- ### Execute sample command with percentage Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/sample.mdx Run the sample command using the alias 'sa' to create a 10% subset of the input SQL dump. ```bash sql-splitter sa dump.sql --percent 10 -o dev.sql ``` -------------------------------- ### Get Auto-Increment Syntax Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DBML_SUPPORT.md Returns the dialect-specific syntax for auto-incrementing columns. ```rust fn auto_increment_syntax(&self) -> String { match self.target_dialect { SqlDialect::MySQL => "AUTO_INCREMENT".to_string(), SqlDialect::PostgreSQL => "GENERATED ALWAYS AS IDENTITY".to_string(), SqlDialect::SQLite => "AUTOINCREMENT".to_string(), // Only with INTEGER PRIMARY KEY SqlDialect::MSSQL => "IDENTITY(1,1)".to_string(), } } ``` -------------------------------- ### Initialize dbt project with sql-splitter Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DBT_INTEGRATION_DEEP_DIVE.md Use the dbt-init command to generate a dbt project structure from a SQL dump file. Various flags allow for customization of the project name, profile, and table filtering. ```bash # Basic usage sql-splitter dbt-init dump.sql -o my_dbt_project/ # Customize project name sql-splitter dbt-init dump.sql \ --output my_dbt_project/ \ --name analytics \ --profile snowflake # Filter tables (only include specific tables) sql-splitter dbt-init dump.sql -o dbt/ --tables users,orders,products # Include marts layer scaffolding sql-splitter dbt-init dump.sql -o dbt/ --with-marts ``` -------------------------------- ### Redaction Configuration File Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/cookbook/dev-data-seeding.mdx Example YAML configuration for defining redaction strategies. ```yaml seed: 12345 locale: en rules: - column: "*.email" strategy: hash - column: "*.name" strategy: fake generator: name - column: "*.ssn" strategy: "null" - column: "*.phone" strategy: fake generator: phone - column: "*.credit_card" strategy: mask pattern: "****-****-****-XXXX" skip_tables: - schema_migrations - ar_internal_metadata ``` -------------------------------- ### Initialize and Run dbt Project Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/DBT_INTEGRATION_DEEP_DIVE.md Commands to generate a dbt project from a SQL dump and execute initial dbt operations. ```bash # 1. Generate complete dbt project from dump sql-splitter dbt-init dump.sql -o my_dbt_project/ # Creates: # - dbt_project.yml # - models/sources.yml (all tables configured) # - models/schema.yml (tests auto-generated from constraints) # - models/staging/*.sql (one model per table) # - README.md # 2. Run dbt immediately cd my_dbt_project/ dbt run # ✓ Works out of the box! dbt test # ✓ 50+ tests auto-generated dbt docs generate # ✓ Full documentation # 3. Iterate and refine # Developers focus on business logic, not YAML boilerplate ``` -------------------------------- ### Pipeline Parallelism Concept Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/PARALLEL_ALL_COMMANDS_ANALYSIS.md Conceptual example of pipeline parallelism for sampling operations. ```rust // While sampling orders, start pre-filtering order_items // But gains are minimal for added complexity ``` -------------------------------- ### CSV Input Format Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/features/SCHEMA_INFERENCE.md Example CSV file structure for schema inference. ```csv id,email,age,created_at 1,alice@example.com,28,2024-01-15 2,bob@example.com,35,2024-01-16 ``` -------------------------------- ### Verify implementation and commit Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/superpowers/plans/2026-07-16-gen-fixtures-performance.md Commands to run tests, check formatting, and commit the changes. ```bash cargo test -p test_data_gen streaming::tests::sql_string_formats_each_dialect cargo test -p test_data_gen cargo fmt --all -- --check cargo clippy -p test_data_gen --all-targets -- -D warnings ``` ```bash git add crates/test_data_gen/src/streaming.rs git commit -m "perf(test-data-gen): stream escaped SQL strings" ``` -------------------------------- ### SQL Schema Definition Source: https://github.com/helgesverre/sql-splitter/blob/main/docs/INTEGRATION_ROADMAP_MASTER.md Example of a standard SQL table definition before conversion. ```sql CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, email VARCHAR(255) NOT NULL UNIQUE, age INT CHECK (age >= 18) ); ``` -------------------------------- ### Reload Shell Configuration Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/completions.mdx Commands to reload shell configuration files after installing completions. ```bash # Bash source ~/.bashrc # Zsh source ~/.zshrc # Fish (usually automatic, but try) source ~/.config/fish/config.fish # PowerShell . $PROFILE ``` -------------------------------- ### Install sql-splitter skill in VS Code / GitHub Copilot Source: https://github.com/helgesverre/sql-splitter/blob/main/website/llms.txt Clone the repository and copy the skill directory to the project's .github/skills directory. ```bash # Copy to project's GitHub skills directory git clone https://github.com/helgesverre/sql-splitter.git /tmp/sql-splitter cp -r /tmp/sql-splitter/skills/sql-splitter .github/skills/ ``` -------------------------------- ### Interactive REPL session Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/cookbook/analytics-queries.mdx Example commands and output within the interactive REPL environment. ```text sql> .tables users orders products sql> .schema users CREATE TABLE users ( id INT PRIMARY KEY, name VARCHAR(100), email VARCHAR(255) ); sql> SELECT COUNT(*) FROM users; ┌──────────────┐ │ count_star() │ ├──────────────┤ │ 1500 │ └──────────────┘ sql> .sample orders 5 ┌────┬─────────┬────────┐ │ id │ user_id │ total │ ├────┼─────────┼────────┤ │ 1 │ 42 │ 99.99 │ │ 2 │ 17 │ 149.50 │ ... sql> .exit ``` -------------------------------- ### Mermaid ER Diagram Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/graph.mdx Example of an ER diagram definition using Mermaid syntax. ```mermaid erDiagram users { INT id PK VARCHAR name VARCHAR email } orders { INT id PK INT user_id FK } orders }|--|| users : user_id ``` -------------------------------- ### Basic Usage Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/split.mdx The primary command structure for splitting SQL files. ```bash sql-splitter split [OPTIONS] ``` -------------------------------- ### Basic Usage Syntax Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/order.mdx The standard command structure for reordering SQL files. ```bash sql-splitter order [OPTIONS] ``` -------------------------------- ### Generate Graphviz DOT Schema Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/graph.mdx Example of a DOT file structure for schema visualization. ```text digraph schema { rankdir=LR; users [label="users|id INT PK\lname VARCHAR\lemail VARCHAR\l"]; orders [label="orders|id INT PK\luser_id INT FK\l"]; orders -> users [label="user_id"]; } ``` -------------------------------- ### Analyze command output example Source: https://github.com/helgesverre/sql-splitter/blob/main/website/src/content/docs/commands/analyze.mdx The standard console output format after running an analysis. ```text Analyzing SQL file: dump.sql (0.15 MB) [dialect: mysql] ✓ Analysis completed in 25.4ms Found 4 tables: Table Name INSERTs Total Stmts Size (MB) ──────────────────────────────────────────────────────────────────────────────── order_items 12 13 0.09 orders 5 6 0.04 products 1 2 0.01 users 2 3 0.01 ──────────────────────────────────────────────────────────────────────────────── TOTAL 20 - 0.15 ```