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 The function will have to return metadata as dict
""" """
name: str
function: Callable function: Callable
extra_kwrds: dict = {} extra_kwrds: dict = {}
class Flux(BaseModel): class Flux(BaseModel):
id: str
name: str
sources: list[Table] sources: list[Table]
targets: list[Table] targets: list[Table]
transformation: Transformation transformation: Transformation

View File

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

View File

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