Snowflake Commands Reference¶
Overview¶
This page provides comprehensive reference documentation for Snowflake-to-Snowflake validation commands in the Snowflake Data Validation CLI. This feature enables validation between different Snowflake accounts, regions, or databases—useful for cross-account migrations, region migrations, or verifying data replication.
For other source platforms, see SQL Server Commands Reference, Teradata Commands Reference, or Redshift Commands Reference.
Command Structure¶
All Snowflake commands follow this consistent structure:
Where <command> is one of:
run-validation- Run synchronous validationrun-async-validation- Run asynchronous validationgenerate-validation-scripts- Generate validation scriptsget-configuration-files- Get configuration templatesauto-generated-configuration-file- Interactive config generationrow-partitioning-helper- Interactive row partitioning configurationcolumn-partitioning-helper- Interactive column partitioning configurationsource-validate- Execute validation on source only and save results as Parquet files
Run Synchronous Validation¶
Validates data between source and target Snowflake databases in real-time.
Syntax¶
Options¶
--data-validation-config-file, -dvf (required)
Type: String (path)
Description: Path to YAML configuration file containing validation settings
Example:
--data-validation-config-file ./configs/snowflake_validation.yaml
--log-level, -ll (optional)
Type: String
Valid Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
Default: INFO
Description: Logging level for validation execution
Example:
--log-level DEBUG
Example Usage¶
Use Cases¶
Cross-account Snowflake migration validation
Cross-region data replication verification
Database copy validation within the same account
Pre-cutover validation checks
Post-migration verification
Continuous validation in CI/CD pipelines
Run Asynchronous Validation¶
Performs validation using pre-generated metadata files without connecting to databases.
Syntax¶
Options¶
--data-validation-config-file, -dvf (required)
Type: String (path)
Description: Path to YAML configuration file
Note: Configuration must specify paths to pre-generated metadata files
Example Usage¶
Prerequisites¶
Before running async validation:
Generate validation scripts using
generate-validation-scriptsExecute the generated scripts on source and target Snowflake databases
Save results to metadata files
Ensure metadata files are available in the configured paths
Use Cases¶
Validating in environments with restricted database access
Separating metadata extraction from validation
Batch validation workflows
Scheduled validation jobs
When database connections are intermittent
Source Validate¶
Executes validation queries on the source Snowflake database only and saves results as Parquet files for later comparison without needing source database access.
Syntax¶
Options¶
--data-validation-config-file, -dvf (required)
Type: String (path)
Description: Path to YAML configuration file
--log-level, -ll (optional)
Type: String
Valid Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
Default: INFO
Description: Logging level for validation execution
Example:
--log-level DEBUG
Example Usage¶
Output¶
The command generates Parquet files in the configured output directory containing:
Schema metadata from source tables
Metrics data (row counts, statistics)
Row-level data for comparison (if row validation is enabled)
Use Cases¶
Offline validation: Extract source data once, validate multiple times
Network-restricted environments: Export data when source is accessible, validate later
Performance optimization: Separate data extraction from comparison
Archival purposes: Keep point-in-time snapshots of source metadata
Cross-environment validation: Extract from production, validate in development
Generate Validation Scripts¶
Generates SQL scripts for Snowflake metadata extraction that can be executed separately.
Syntax¶
Options¶
--data-validation-config-file, -dvf (required)
Type: String (path)
Description: Path to YAML configuration file
Example Usage¶
Output¶
The command generates SQL scripts in the output directory configured in your YAML file:
Use Cases¶
Generating scripts for execution by DBAs
Compliance requirements for query review
Environments where direct CLI database access is restricted
Manual execution and validation workflows
Separating metadata extraction from validation
Get Configuration Templates¶
Retrieves Snowflake configuration templates for validation setup.
Syntax¶
Options¶
--templates-directory, -td (optional)
Type: String (path)
Default: Current directory
Description: Directory to save template files
Example:
--templates-directory ./templates
--query-templates (optional)
Type: Flag (no value required)
Description: Include J2 (Jinja2) query template files for advanced customization
Example:
--query-templates
Example Usage¶
Output Files¶
Without --query-templates flag:
With --query-templates flag:
Use Cases¶
Starting a new Snowflake-to-Snowflake validation project
Learning Snowflake-specific configuration options
Customizing validation queries
Creating organization-specific templates
Auto-Generate Configuration File¶
Interactive command to generate a configuration file by prompting for Snowflake connection parameters.
Syntax¶
Options¶
This command has no command-line options. All input is provided through interactive prompts.
Interactive Prompts¶
The command will prompt for the following information:
Snowflake Named Connection name
Name of pre-configured Snowflake connection
Default:
defaultExample:
my_snowflake_connection
Snowflake database
Name of the database to validate
Example:
PRODUCTION_DB
Snowflake schema
Schema name within the database
Example:
PUBLIC
Output path for configuration file
Where to save the generated YAML file
Example:
./configs/snowflake_config.yaml
Example Session¶
Generated Configuration¶
The command generates a basic YAML configuration file:
Next Steps After Generation¶
Edit the configuration file to add:
Target connection details (if not using default)
Tables to validate
Validation options
Column selections and mappings
Review connection settings:
Verify source and target connection names
Consider using environment variables for sensitive data
Add table configurations:
Specify fully qualified table names
Configure column selections
Set up filtering where clauses
Test the configuration:
Use Cases¶
Quick setup for new Snowflake-to-Snowflake users
Generating baseline configurations
Testing connectivity during setup
Creating template configurations for teams
Row Partitioning Helper¶
Interactive command to generate partitioned table configurations for large tables. This helper divides tables into smaller row partitions based on a specified column, enabling more efficient validation of large datasets.
Syntax¶
Options¶
This command has no command-line options. All input is provided through interactive prompts.
How It Works¶
The row partitioning helper:
Reads an existing configuration file with table definitions
For each table, prompts whether to apply partitioning
If partitioning is enabled, collects partition parameters
Queries the source Snowflake database to determine partition boundaries
Generates new table configurations with
WHEREclauses for each partitionSaves the partitioned configuration to a new file
Interactive Prompts¶
The command will prompt for the following information:
Configuration file path
Path to existing YAML configuration file
Example:
./configs/snowflake_validation.yaml
For each table in the configuration:
a. Apply partitioning? (yes/no)
Whether to partition this specific table
Default: yes
b. Partition column (if partitioning)
Column name used to divide the table
Should be indexed or clustered for performance
Example:
transaction_id,created_date
c. Is partition column a string type? (yes/no)
Determines quoting in generated WHERE clauses
Default: no (numeric)
d. Number of partitions
How many partitions to create
Example:
10,50,100
Example Session¶
Generated Output¶
The command generates partitioned table configurations with WHERE clauses:
Use Cases¶
Large table validation: Break multi-billion row tables into manageable chunks
Parallel processing: Enable concurrent validation of different partitions
Memory optimization: Reduce memory footprint by processing smaller data segments
Incremental validation: Validate specific data ranges independently
Performance tuning: Optimize validation for tables with uneven data distribution
Best Practices¶
Choose appropriate partition columns:
Use clustered columns for better query performance
Prefer columns with sequential values (IDs, timestamps)
Avoid columns with highly skewed distributions
Determine optimal partition count:
Consider table size and available resources
Start with 10-20 partitions for tables with 10M+ rows
Increase partitions for very large tables (100M+ rows)
String vs numeric columns:
Numeric columns are generally more efficient
String columns work but may have uneven distribution
After partitioning:
Review generated WHERE clauses
Adjust partition boundaries if needed
Test with a subset before full validation
Column Partitioning Helper¶
Interactive command to generate partitioned table configurations for wide tables with many columns. This helper divides tables into smaller column partitions, enabling more efficient validation of tables with a large number of columns.
Syntax¶
Options¶
This command has no command-line options. All input is provided through interactive prompts.
How It Works¶
The column partitioning helper:
Reads an existing configuration file with table definitions
For each table, prompts whether to apply column partitioning
If partitioning is enabled, collects the number of partitions
Queries the source Snowflake database to retrieve all column names for the table
Divides the columns into the specified number of partitions
Generates new table configurations where each partition validates only a subset of columns
Saves the partitioned configuration to a new file
Interactive Prompts¶
The command will prompt for the following information:
Configuration file path
Path to existing YAML configuration file
Example:
./configs/snowflake_validation.yaml
For each table in the configuration:
a. Apply column partitioning? (yes/no)
Whether to partition this specific table by columns
Default: yes
b. Number of partitions (if partitioning)
How many column partitions to create
Example:
3,5,10
Example Session¶
Generated Output¶
The command generates partitioned table configurations with column subsets:
Use Cases¶
Wide table validation: Break tables with hundreds of columns into manageable chunks
Memory optimization: Reduce memory footprint by validating fewer columns at a time
Parallel processing: Enable concurrent validation of different column groups
Targeted validation: Validate specific column groups independently
Performance tuning: Optimize validation for tables with many VARIANT or complex columns
Best Practices¶
Determine optimal partition count:
Consider the total number of columns in the table
For tables with 50+ columns, start with 3-5 partitions
For tables with 100+ columns, consider 5-10 partitions
Column ordering:
Columns are divided alphabetically
Related columns may end up in different partitions
After partitioning:
Review generated column lists
Verify all required columns are included
Test with a subset before full validation
Combine with row partitioning:
For very large, wide tables, consider using both row and column partitioning
First partition by columns, then apply row partitioning to each column partition if needed
Snowflake Connection Configuration¶
Snowflake connections support multiple modes for both source and target databases.
Connection Modes¶
Option 1: Named Connection¶
Use a pre-configured Snowflake connection saved in your Snowflake connections file.
Fields:
mode(required): Must be"name"name(required): Name of the saved Snowflake connection
Option 2: Default Connection¶
Use the default Snowflake connection from your environment.
Fields:
mode(required): Must be"default"
Option 3: Credentials Mode (IPC Only)¶
Note: The
credentialsmode is only available when using IPC (Inter-Process Communication) commands directly via CLI parameters, not in YAML configuration files. This mode is exclusive to the SnowConvert UI.
Connection Examples¶
Same Account, Different Databases:
Cross-Account Validation:
Cross-Region Migration:
Development to Production Comparison:
Setting Up Named Connections¶
Snowflake connections are typically configured using the Snowflake CLI or SnowSQL configuration files.
SnowSQL Configuration Example (~/.snowsql/config):
Snowflake CLI Configuration Example (~/.snowflake/connections.toml):
Complete Snowflake Examples¶
Example 1: Basic Snowflake-to-Snowflake Configuration¶
Example 2: Cross-Account Migration Validation¶
Example 3: Cross-Region Replication Validation¶
Example 4: Database Copy Validation¶
Example 5: Snowflake View Validation¶
Validate Snowflake views alongside tables for comprehensive data verification.
Note: View validation creates temporary tables internally to materialize view data for comparison between source and target Snowflake databases.
Troubleshooting Snowflake Connections¶
Issue: Connection Not Found¶
Symptom:
Solutions:
Verify the connection name is correct:
Check your Snowflake connections configuration file
Ensure the connection file has proper permissions
Verify the connection name matches exactly (case-sensitive)
Issue: Authentication Failed¶
Symptom:
Solutions:
Verify credentials are correct
Check if using correct authentication method:
Password authentication
Key pair authentication
SSO/OAuth
Verify user has necessary permissions:
Check if account is correct (including region suffix)
Issue: Database/Schema Not Found¶
Symptom:
Solutions:
Verify database/schema names are correct (case-sensitive in Snowflake)
Check user has access to the database:
Verify the warehouse is running:
Issue: Cross-Account Access Denied¶
Symptom:
Solutions:
Verify both accounts have correct connection configurations
Check if data sharing is properly configured between accounts
Verify network policies allow cross-account connections
Ensure both connections use appropriate credentials
Issue: Timeout Errors¶
Symptom:
Solutions:
Increase warehouse size:
Enable chunking for large tables:
Add WHERE clauses to limit data:
Reduce thread count if warehouse is overloaded:
Best Practices for Snowflake-to-Snowflake Validation¶
Connection Management¶
Use named connections:
Store credentials securely:
Use Snowflake CLI connection configuration
Leverage key pair authentication for production
Avoid hardcoding passwords
Use appropriate roles:
Performance Optimization¶
Size warehouses appropriately:
Enable chunking for large tables:
Use WHERE clauses to filter data:
Optimize thread count:
Consider time-based filtering for incremental validation:
Data Quality¶
Start with schema validation:
Progress to metrics validation:
Enable row validation selectively:
Cross-Account/Region Considerations¶
Account for replication lag:
Allow time for replication to complete before validation
Use time-based filters that account for lag
Handle naming differences:
Monitor costs:
Cross-region data transfer incurs costs
Schedule validations during off-peak hours
Use sampling for initial validation
Use appropriate tolerance: