Skip to content

Commit 5b312ff

Browse files
goldmedalcougrimes
andauthored
feat(wren-launcher): Expanded dbt<>Wren MDL conversions, added BigQuery support (#1965)
Co-authored-by: Casey Grimes <[email protected]> Co-authored-by: Casey Grimes <[email protected]>
1 parent 3edba06 commit 5b312ff

File tree

9 files changed

+1265
-198
lines changed

9 files changed

+1265
-198
lines changed

wren-launcher/commands/dbt.go

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ import (
1212
// then converts them to WrenDataSource and Wren MDL format
1313
func DbtAutoConvert() {
1414
var opts struct {
15-
ProjectPath string
16-
OutputDir string
17-
ProfileName string
18-
Target string
15+
ProjectPath string
16+
OutputDir string
17+
ProfileName string
18+
Target string
19+
IncludeStagingModels bool
1920
}
2021

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

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

4143
// ConvertOptions struct for core conversion logic
4244
convertOpts := dbt.ConvertOptions{
43-
ProjectPath: opts.ProjectPath,
44-
OutputDir: opts.OutputDir,
45-
ProfileName: opts.ProfileName,
46-
Target: opts.Target,
47-
RequireCatalog: true, // DbtAutoConvert requires catalog.json to exist
45+
ProjectPath: opts.ProjectPath,
46+
OutputDir: opts.OutputDir,
47+
ProfileName: opts.ProfileName,
48+
Target: opts.Target,
49+
RequireCatalog: true, // DbtAutoConvert requires catalog.json to exist
50+
IncludeStagingModels: opts.IncludeStagingModels,
4851
}
4952

5053
// Call the core conversion logic
@@ -57,14 +60,15 @@ func DbtAutoConvert() {
5760

5861
// DbtConvertProject is a public wrapper function for processDbtProject to use
5962
// It converts a dbt project without requiring catalog.json to exist
60-
func DbtConvertProject(projectPath, outputDir, profileName, target string, usedByContainer bool) (*dbt.ConvertResult, error) {
63+
func DbtConvertProject(projectPath, outputDir, profileName, target string, usedByContainer bool, IncludeStagingModels bool) (*dbt.ConvertResult, error) {
6164
convertOpts := dbt.ConvertOptions{
62-
ProjectPath: projectPath,
63-
OutputDir: outputDir,
64-
ProfileName: profileName,
65-
Target: target,
66-
RequireCatalog: false, // Allow processDbtProject to continue without catalog.json
67-
UsedByContainer: usedByContainer,
65+
ProjectPath: projectPath,
66+
OutputDir: outputDir,
67+
ProfileName: profileName,
68+
Target: target,
69+
RequireCatalog: false, // Allow processDbtProject to continue without catalog.json
70+
UsedByContainer: usedByContainer,
71+
IncludeStagingModels: IncludeStagingModels,
6872
}
6973

7074
return dbt.ConvertDbtProjectCore(convertOpts)

0 commit comments

Comments
 (0)