File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -502,8 +502,14 @@ def create_builtin_globals(
502502 else :
503503 builtin_globals ["model" ] = AttributeDict (model .copy ())
504504
505+ builtin_globals ["flags" ] = (
506+ Flags (which = "run" ) if engine_adapter is not None else Flags (which = "parse" )
507+ )
508+ builtin_globals ["invocation_args_dict" ] = {
509+ k .lower (): v for k , v in builtin_globals ["flags" ].__dict__ .items ()
510+ }
511+
505512 if engine_adapter is not None :
506- builtin_globals ["flags" ] = Flags (which = "run" )
507513 adapter : BaseAdapter = RuntimeAdapter (
508514 engine_adapter ,
509515 jinja_macros ,
@@ -521,7 +527,6 @@ def create_builtin_globals(
521527 project_dialect = project_dialect ,
522528 )
523529 else :
524- builtin_globals ["flags" ] = Flags (which = "parse" )
525530 adapter = ParsetimeAdapter (
526531 jinja_macros ,
527532 jinja_globals = {** builtin_globals , ** jinja_globals },
Original file line number Diff line number Diff line change @@ -1435,6 +1435,14 @@ def test_flags(sushi_test_project: Project):
14351435 assert context .render ("{{ flags.WHICH }}" ) == "parse"
14361436
14371437
1438+ def test_invocation_args_dict (sushi_test_project : Project ):
1439+ context = sushi_test_project .context
1440+
1441+ assert context .render ("{{ invocation_args_dict['full_refresh'] }}" ) == "None"
1442+ assert context .render ("{{ invocation_args_dict['store_failures'] }}" ) == "None"
1443+ assert context .render ("{{ invocation_args_dict['which'] }}" ) == "parse"
1444+
1445+
14381446@pytest .mark .xdist_group ("dbt_manifest" )
14391447def test_relation (sushi_test_project : Project ):
14401448 context = sushi_test_project .context
You can’t perform that action at this time.
0 commit comments