Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions wren-launcher/commands/dbt.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ import (
// then converts them to WrenDataSource and Wren MDL format
func DbtAutoConvert() {
var opts struct {
ProjectPath string
OutputDir string
ProfileName string
Target string
ProjectPath string
OutputDir string
ProfileName string
Target string
IncludeStagingModels bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice improvement 👍

}

// Define command line flags
flag.StringVar(&opts.ProjectPath, "path", "", "Path to the dbt project root directory")
flag.StringVar(&opts.OutputDir, "output", "", "Output directory for generated JSON files")
flag.StringVar(&opts.ProfileName, "profile", "", "Specific profile name to use (optional, uses first found if not provided)")
flag.StringVar(&opts.Target, "target", "", "Specific target to use (optional, uses profile default if not provided)")
flag.BoolVar(&opts.IncludeStagingModels, "include-staging-models", false, "If set, staging models will be included during conversion")
flag.Parse()

// Validate required parameters
Expand All @@ -40,11 +42,12 @@ func DbtAutoConvert() {

// ConvertOptions struct for core conversion logic
convertOpts := dbt.ConvertOptions{
ProjectPath: opts.ProjectPath,
OutputDir: opts.OutputDir,
ProfileName: opts.ProfileName,
Target: opts.Target,
RequireCatalog: true, // DbtAutoConvert requires catalog.json to exist
ProjectPath: opts.ProjectPath,
OutputDir: opts.OutputDir,
ProfileName: opts.ProfileName,
Target: opts.Target,
RequireCatalog: true, // DbtAutoConvert requires catalog.json to exist
IncludeStagingModels: opts.IncludeStagingModels,
}

// Call the core conversion logic
Expand All @@ -57,15 +60,16 @@ func DbtAutoConvert() {

// DbtConvertProject is a public wrapper function for processDbtProject to use
// It converts a dbt project without requiring catalog.json to exist
func DbtConvertProject(projectPath, outputDir, profileName, target string, usedByContainer bool) (*dbt.ConvertResult, error) {
func DbtConvertProject(projectPath, outputDir, profileName, target string, usedByContainer bool, IncludeStagingModels bool) (*dbt.ConvertResult, error) {
convertOpts := dbt.ConvertOptions{
ProjectPath: projectPath,
OutputDir: outputDir,
ProfileName: profileName,
Target: target,
RequireCatalog: false, // Allow processDbtProject to continue without catalog.json
UsedByContainer: usedByContainer,
ProjectPath: projectPath,
OutputDir: outputDir,
ProfileName: profileName,
Target: target,
RequireCatalog: false, // Allow processDbtProject to continue without catalog.json
UsedByContainer: usedByContainer,
IncludeStagingModels: IncludeStagingModels,
}

return dbt.ConvertDbtProjectCore(convertOpts)
}
}
Loading