Skip to content

Commit

Permalink
chore: make example config injector more obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Jul 20, 2024
1 parent 8427192 commit ac941f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cdf/nextgen/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@ def get_config_sources(self):
# Create an instance of the workspace
datateam = DataTeamWorkspace()

@injector.map_values(b="a.b.c")
def c(b: int) -> int:
return b * 10
@injector.map_values(secret_number="a.b.c")
def c(secret_number: int) -> int:
return secret_number * 10

# Imperatively add dependencies
datateam.add_dependency("c", injector.Dependency(c))
datateam.config_resolver.import_({"a.b.c": 10})

def source_a(a: int, prod_bigquery: str):
print(f"Source A: {a=}, {prod_bigquery=}")
Expand All @@ -129,6 +130,7 @@ def source_a(a: int, prod_bigquery: str):
print(datateam.name)
print(datateam.config_resolver["sfdc.username"])
print(datateam.injector.get_or_raise("sfdc"))
print(datateam.config_resolver(c))

# Run the autogenerated CLI
datateam.cli()

0 comments on commit ac941f9

Please sign in to comment.