@@ -36,7 +36,10 @@ def _gen_config(
3636 start : t .Optional [str ],
3737 template : ProjectTemplate ,
3838 cli_mode : InitCliMode ,
39+ dialect : t .Optional [str ] = None ,
3940) -> str :
41+ project_dialect = dialect or DIALECT_TO_TYPE .get (engine_type )
42+
4043 connection_settings = (
4144 settings
4245 or """ type: duckdb
@@ -96,7 +99,7 @@ def _gen_config(
9699# https://sqlmesh.readthedocs.io/en/stable/reference/model_configuration/#model-defaults
97100
98101model_defaults:
99- dialect: { DIALECT_TO_TYPE . get ( engine_type ) }
102+ dialect: { project_dialect }
100103 start: { start or yesterday_ds ()} # Start date for backfill history
101104 cron: '@daily' # Run models daily at 12am UTC (can override per model)
102105
@@ -274,6 +277,7 @@ def _gen_example_objects(schema_name: str) -> ExampleObjects:
274277def init_example_project (
275278 path : t .Union [str , Path ],
276279 engine_type : t .Optional [str ],
280+ dialect : t .Optional [str ] = None ,
277281 template : ProjectTemplate = ProjectTemplate .DEFAULT ,
278282 pipeline : t .Optional [str ] = None ,
279283 dlt_path : t .Optional [str ] = None ,
@@ -314,17 +318,17 @@ def init_example_project(
314318 settings = None
315319 start = None
316320 if engine_type and template == ProjectTemplate .DLT :
317- dialect = DIALECT_TO_TYPE .get (engine_type )
318- if pipeline and dialect :
321+ project_dialect = dialect or DIALECT_TO_TYPE .get (engine_type )
322+ if pipeline and project_dialect :
319323 dlt_models , settings , start = generate_dlt_models_and_settings (
320- pipeline_name = pipeline , dialect = dialect , dlt_path = dlt_path
324+ pipeline_name = pipeline , dialect = project_dialect , dlt_path = dlt_path
321325 )
322326 else :
323327 raise SQLMeshError (
324328 "Please provide a DLT pipeline with the `--dlt-pipeline` flag to generate a SQLMesh project from DLT."
325329 )
326330
327- _create_config (config_path , engine_type , settings , start , template , cli_mode )
331+ _create_config (config_path , engine_type , dialect , settings , start , template , cli_mode )
328332 if template == ProjectTemplate .DBT :
329333 return config_path
330334
@@ -359,12 +363,13 @@ def _create_folders(target_folders: t.Sequence[Path]) -> None:
359363def _create_config (
360364 config_path : Path ,
361365 engine_type : t .Optional [str ],
366+ dialect : t .Optional [str ],
362367 settings : t .Optional [str ],
363368 start : t .Optional [str ],
364369 template : ProjectTemplate ,
365370 cli_mode : InitCliMode ,
366371) -> None :
367- project_config = _gen_config (engine_type , settings , start , template , cli_mode )
372+ project_config = _gen_config (engine_type , settings , start , template , cli_mode , dialect )
368373
369374 _write_file (
370375 config_path ,
0 commit comments