@@ -11,7 +11,7 @@ class ProjectTemplate(Enum):
1111 DEFAULT = "default"
1212
1313
14- def _gen_config (dialect : str , template : ProjectTemplate ) -> str :
14+ def _gen_config (dialect : t . Optional [ str ] , template : ProjectTemplate ) -> str :
1515
1616 default_configs = {
1717 ProjectTemplate .DEFAULT : f"""gateways:
@@ -46,7 +46,7 @@ def _gen_config(dialect: str, template: ProjectTemplate) -> str:
4646
4747from sqlmesh.dbt.loader import sqlmesh_config
4848
49- config = sqlmesh_config(Path(__file__).parent, default_sql_dialect='{dialect}') )
49+ config = sqlmesh_config(Path(__file__).parent)
5050""" ,
5151 }
5252
@@ -153,7 +153,9 @@ def _gen_config(dialect: str, template: ProjectTemplate) -> str:
153153
154154
155155def init_example_project (
156- path : t .Union [str , Path ], dialect : str , template : ProjectTemplate = ProjectTemplate .DEFAULT
156+ path : t .Union [str , Path ],
157+ dialect : t .Optional [str ],
158+ template : ProjectTemplate = ProjectTemplate .DEFAULT ,
157159) -> None :
158160 root_path = Path (path )
159161 config_extension = "py" if template == ProjectTemplate .DBT else "yaml"
@@ -167,6 +169,11 @@ def init_example_project(
167169 if config_path .exists ():
168170 raise click .ClickException (f"Found an existing config in '{ config_path } '" )
169171
172+ if not dialect and template != ProjectTemplate .DBT :
173+ raise click .ClickException (
174+ "Default SQL dialect is a required argument for SQLMesh projects"
175+ )
176+
170177 _create_config (config_path , dialect , template )
171178 if template == ProjectTemplate .DBT :
172179 return
@@ -185,7 +192,7 @@ def _create_folders(target_folders: t.Sequence[Path]) -> None:
185192 (folder_path / ".gitkeep" ).touch ()
186193
187194
188- def _create_config (config_path : Path , dialect : str , template : ProjectTemplate ) -> None :
195+ def _create_config (config_path : Path , dialect : t . Optional [ str ] , template : ProjectTemplate ) -> None :
189196 project_config = _gen_config (dialect , template )
190197
191198 _write_file (
0 commit comments