@sqlsmith/cli
v0.6.1
Published
CLI for SQLsmith - SQL schema merging with dependency resolution
Maintainers
Readme
@sqlsmith/cli
Command-line interface for SQLsmith - SQL schema merging with dependency resolution.
Installation
# Global installation
npm install -g @sqlsmith/cli
# Or use with npx
npx @sqlsmith/cliUsage
# Merge SQL files (to stdout by default)
sqlsmith ./schemas --output merged.sql
# Analyze dependencies
sqlsmith info ./schemas
# Validate files
sqlsmith validate ./schemasCommands
Merge (default)
sqlsmith <input-directory> [options]Info
sqlsmith info <input-directory> [options]Validate
sqlsmith validate <input-directory> [options]Options
-o, --output <path>- Output file path (default: stdout)-d, --dialect <dialect>- SQL dialect from core'sSUPPORTED_DIALECTSregistry--default-schema <schema>- Schema assigned to unqualified names (PostgreSQL default:public)--no-validate-source-order- Skip validation that statements within a file are declared before their dependents--allow-external-references- Allow foreign keys referencing tables outside the input files--log-level <level>- Set log level: silent, error, warn, info, debug (default: info)
Log Levels
The --log-level option controls the verbosity of console output:
silent- Suppress all log output (merged SQL still goes to stdout, exit codes are preserved)error- Only show error messageswarn- Show error and warning messagesinfo- Show error, warning, and info messages (default)debug- Show all messages including debug information
Examples
# Merge SQL files to stdout with default settings
sqlsmith ./schemas
# Merge to a specific output file
sqlsmith ./schemas --output merged.sql
# Merge with minimal console output
sqlsmith ./schemas --log-level error --output merged.sql
# Analyze dependencies with debug information
sqlsmith info ./schemas --log-level debug
# Validate with only warnings and errors
sqlsmith validate ./schemas --log-level warn
# Use different SQL dialect
sqlsmith ./schemas --dialect mysql --output merged.sql
# Resolve unqualified PostgreSQL names in a tenant schema
sqlsmith ./schemas --default-schema tenant --output merged.sqlSET search_path is preserved in merged SQL but does not alter dependency
resolution; use --default-schema for the effective schema.
License
MIT
