1414 YamlRefactorContext ,
1515 YamlRefactorSettings ,
1616 apply_restructure_plan ,
17- commit_yamls ,
1817 compile_sql_code ,
1918 create_dbt_project_context ,
2019 create_missing_source_yamls ,
2625 inject_missing_columns ,
2726 remove_columns_not_in_database ,
2827 sort_columns_as_configured ,
29- sync_node_to_yaml ,
3028 synchronize_data_types ,
3129 synthesize_missing_documentation_with_openai ,
3230)
@@ -264,15 +262,18 @@ def refactor(
264262 apply_restructure_plan (
265263 context = context , plan = draft_restructure_delta_plan (context ), confirm = not auto_apply
266264 )
267- inject_missing_columns (context = context )
268- remove_columns_not_in_database (context = context )
269- inherit_upstream_column_knowledge (context = context )
270- sort_columns_as_configured (context = context )
271- synchronize_data_types (context = context )
265+
266+ transform = (
267+ inject_missing_columns
268+ >> remove_columns_not_in_database
269+ >> inherit_upstream_column_knowledge
270+ >> sort_columns_as_configured
271+ >> synchronize_data_types
272+ )
272273 if synthesize :
273- synthesize_missing_documentation_with_openai ( context = context )
274- sync_node_to_yaml ( context = context )
275- commit_yamls (context = context )
274+ transform >>= synthesize_missing_documentation_with_openai
275+
276+ _ = transform (context = context )
276277
277278 if check and context .mutated :
278279 exit (1 )
@@ -396,11 +397,6 @@ def organize(
396397 is_flag = True ,
397398 help = "Output yaml file columns and data types in lowercase if possible." ,
398399)
399- @click .option (
400- "--auto-apply" ,
401- is_flag = True ,
402- help = "Automatically apply the restructure plan without confirmation." ,
403- )
404400@click .option (
405401 "--synthesize" ,
406402 is_flag = True ,
@@ -442,13 +438,13 @@ def document(
442438 if vars :
443439 settings .vars = context .yaml_handler .load (io .StringIO (vars )) # pyright: ignore[reportUnknownMemberType]
444440
445- inject_missing_columns ( context = context )
446- inherit_upstream_column_knowledge ( context = context )
447- sort_columns_as_configured ( context = context )
441+ transform = (
442+ inject_missing_columns >> inherit_upstream_column_knowledge >> sort_columns_as_configured
443+ )
448444 if synthesize :
449- synthesize_missing_documentation_with_openai ( context = context )
450- sync_node_to_yaml ( context = context )
451- commit_yamls (context = context )
445+ transform >>= synthesize_missing_documentation_with_openai
446+
447+ _ = transform (context = context )
452448
453449 if check and context .mutated :
454450 exit (1 )
@@ -548,10 +544,14 @@ def run(
548544 project_dir : str | None = None ,
549545 profiles_dir : str | None = None ,
550546 target : str | None = None ,
547+ ** kwargs : t .Any ,
551548) -> None :
552549 """Executes a dbt SQL statement writing results to stdout"""
553550 settings = DbtConfiguration (
554- project_dir = t .cast (str , project_dir ), profiles_dir = t .cast (str , profiles_dir ), target = target
551+ project_dir = t .cast (str , project_dir ),
552+ profiles_dir = t .cast (str , profiles_dir ),
553+ target = target ,
554+ ** kwargs ,
555555 )
556556 project = create_dbt_project_context (settings )
557557 _ , table = execute_sql_code (project , sql )
@@ -574,10 +574,14 @@ def compile(
574574 project_dir : str | None = None ,
575575 profiles_dir : str | None = None ,
576576 target : str | None = None ,
577+ ** kwargs : t .Any ,
577578) -> None :
578579 """Executes a dbt SQL statement writing results to stdout"""
579580 settings = DbtConfiguration (
580- project_dir = t .cast (str , project_dir ), profiles_dir = t .cast (str , profiles_dir ), target = target
581+ project_dir = t .cast (str , project_dir ),
582+ profiles_dir = t .cast (str , profiles_dir ),
583+ target = target ,
584+ ** kwargs ,
581585 )
582586 project = create_dbt_project_context (settings )
583587 node = compile_sql_code (project , sql )
0 commit comments