refact: move id and name to flux

This commit is contained in:
Bertrand Benjamin 2025-01-05 15:50:51 +01:00
parent e4af62b136
commit 041e459ca0
3 changed files with 11 additions and 4 deletions

View File

@ -12,12 +12,13 @@ class Transformation(BaseModel):
The function will have to return metadata as dict
"""
name: str
function: Callable
extra_kwrds: dict = {}
class Flux(BaseModel):
id: str
name: str
sources: list[Table]
targets: list[Table]
transformation: Transformation

View File

@ -21,9 +21,11 @@ def test_consume_flux():
}
flux = Flux(
id="flux",
name="flux",
sources=sources,
targets=targets,
transformation=Transformation(name="func", function=func, extra_kwrds={"extra": "super"}),
transformation=Transformation(function=func, extra_kwrds={"extra": "super"}),
)
meta = consume_flux(flux)

View File

@ -52,9 +52,11 @@ def copy_flux(repository: FSRepository) -> Flux:
extra_kwrds = {}
raw_brz_copy_username = Flux(
id="copy_flux",
name="copy",
sources=raw_username,
targets=bronze_username,
transformation=Transformation(name="copy", function=copy, extra_kwrds=extra_kwrds),
transformation=Transformation(function=copy, extra_kwrds=extra_kwrds),
)
return raw_brz_copy_username
@ -73,9 +75,11 @@ def foo_flux(repository: FSRepository) -> Flux:
extra_kwrds = {}
flux = Flux(
id="foo_flux",
name="foo",
sources=src,
targets=targets,
transformation=Transformation(name="foo", function=foo, extra_kwrds=extra_kwrds),
transformation=Transformation(function=foo, extra_kwrds=extra_kwrds),
)
return flux