From 041e459ca0b78683715d9d60ec5e863b24ceab55 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 5 Jan 2025 15:50:51 +0100 Subject: [PATCH] refact: move id and name to flux --- plesna/models/flux.py | 3 ++- tests/compute/test_consume_flux.py | 4 +++- tests/dataplatform/test_dataplateform.py | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plesna/models/flux.py b/plesna/models/flux.py index 5a2a90e..eb0a553 100644 --- a/plesna/models/flux.py +++ b/plesna/models/flux.py @@ -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 diff --git a/tests/compute/test_consume_flux.py b/tests/compute/test_consume_flux.py index 8006d38..d9033dd 100644 --- a/tests/compute/test_consume_flux.py +++ b/tests/compute/test_consume_flux.py @@ -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) diff --git a/tests/dataplatform/test_dataplateform.py b/tests/dataplatform/test_dataplateform.py index fd0465c..05af77f 100644 --- a/tests/dataplatform/test_dataplateform.py +++ b/tests/dataplatform/test_dataplateform.py @@ -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