Power BI to Snowflake SQL Translator - Convert Power BI models (.bim files) to Snowflake SQL with enhanced M and DAX support.
- Complete Model Translation: Extract and convert entire Power BI data models
- M Language Support: Advanced translation of Power Query M expressions to SQL
- DAX Translation: Convert DAX formulas to Snowflake SQL equivalents
- Relationship Mapping: Preserve table relationships and foreign keys
- View Generation: Create optimized Snowflake views with proper naming conventions
- Configuration Options: Flexible translation modes and confidence levels
- Production Ready: Comprehensive error handling and logging
pip install pbi2snowgit clone https://github.com/llmsresearch/pbi2snow.git
cd pbi2snow
pip install -e .# Basic usage
pbi2snow --bim-file model.bim --output-dir output/
# With custom schema and verbose output
pbi2snow --bim-file model.bim --output-dir output/ --target-schema MY_SCHEMA --verbose
# Production mode with high confidence threshold
pbi2snow --bim-file model.bim --mode production --confidence-threshold 80from pbi2snow import extract
from pbi2snow.translator import UnifiedTranslator, TranslationConfig
# Load Power BI model
model_data = extract.collect('path/to/model.bim')
# Configure translator
config = TranslationConfig(
target_schema='SEMANTIC',
confidence_threshold=70,
mode='production'
)
# Translate model
translator = UnifiedTranslator(config)
results = []
for table in model_data['tables']:
result = translator.translate_table(table)
results.append(result)
print(f"Translated {len(results)} tables")| Option | Short | Default | Description |
|---|---|---|---|
--bim-file |
-b |
input/Model.bim |
Path to the BIM file |
--output-dir |
-o |
out_unified |
Output directory for SQL files |
--target-schema |
-s |
SEMANTIC |
Target Snowflake schema name |
--mode |
-m |
balanced |
Translation mode: conservative, balanced, aggressive |
--confidence-threshold |
-c |
50 |
Minimum confidence level (0-100) |
--verbose |
-v |
False |
Enable verbose logging |
- High accuracy, lower coverage
- Only translates well-understood patterns
- Confidence threshold: 80+
- Good balance of accuracy and coverage
- Handles most common scenarios
- Confidence threshold: 50+
- Maximum coverage, experimental translations
- May require manual review
- Confidence threshold: 20+
output/
├── views/ # Generated Snowflake views
│ ├── V_TABLE_NAME.sql # Individual view files
│ └── ...
├── manifest.json # Translation summary and metadata
└── all_views.sql # Combined SQL file
- Table transformations
- Column operations
- Filtering and grouping
- Joins and merges
- Data type conversions
- Custom functions (limited)
- Basic calculations
- Aggregations (SUM, COUNT, AVG, etc.)
- Time intelligence functions
- Filter functions (FILTER, CALCULATE)
- Relationship functions
- Complex nested expressions (limited)
- Tables and columns
- Relationships and foreign keys
- Calculated columns
- Calculated tables
- Measures (basic)
- Data Warehouse Migration: Move Power BI models to Snowflake
- SQL Modernization: Convert legacy BI logic to modern SQL
- Multi-Platform Support: Run the same logic on different platforms
- Performance Optimization: Leverage Snowflake's compute power
- Compliance & Governance: Centralize data transformations
# Clone the repository
git clone https://github.com/llmsresearch/pbi2snow.git
cd pbi2snow
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black pbi2snow/
flake8 pbi2snow/This project is licensed under the MIT License - see the LICENSE file for details.
- Enhanced DAX function support
- Azure Synapse SQL support
- Power BI Premium integration
- Real-time translation validation
- Visual Studio Code extension
- Automated testing framework