fastflowtransform.decorators¶
model ¶
model(name=None, deps=None, require=None, requires=None, *, tags=None, kind='python', materialized=None, meta=None)
Decorator to register a Python model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Logical node name in the DAG (defaults to function name). |
None
|
deps
|
Sequence[str] | None
|
Upstream node names (e.g., ['users.ff']). |
None
|
require
|
Any | None
|
Required columns per dependency; accepted shapes mirror |
None
|
requires
|
Any | None
|
Alias for |
None
|
tags
|
Sequence[str] | None
|
Optional tags for selection (e.g. ['demo','env']). |
None
|
kind
|
str
|
Logical kind; defaults to 'python' (useful for selectors kind:python). |
'python'
|
materialized
|
str | None
|
Shorthand for meta['materialized']; mirrors config(materialized='...'). |
None
|
meta
|
Mapping[str, Any] | None
|
Arbitrary metadata for executors/docs (merged with materialized if provided). |
None
|
Source code in src/fastflowtransform/decorators.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
engine_model ¶
engine_model(*, only=None, env_match=None, **model_kwargs)
Env-aware decorator to register a Python model only when the current environment matches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
only
|
str | Iterable[str] | None
|
Backwards compatible engine filter based on FF_ENGINE (e.g. only="bigquery" or only=("duckdb", "postgres")). |
None
|
env_match
|
Mapping[str, str] | None
|
Arbitrary environment match, e.g.: env_match={"FF_ENGINE": "bigquery", "FF_ENGINE_VARIANT": "bigframes"} |
None
|
Source code in src/fastflowtransform/decorators.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
dq_test ¶
dq_test(name=None, *, overwrite=False, params_model=None)
Decorator to register a custom data-quality test runner.
Usage:
from fastflowtransform import dq_test
@dq_test("email_domain_allowed")
def email_domain_allowed(executor, table, column, params):
...
return True, None, "select ..."
If name is omitted, the function name is used:
@dq_test()
def email_sanity(executor, table, column, params):
...
# In project.yml / schema.yml: type: email_sanity
Params model:
class EmailTestParams(DQParamsBase):
allowed_domains: list[str]
@dq_test("email_domain_allowed", params_model=EmailTestParams)
def email_domain_allowed(executor, table, column, params: EmailTestParams):
...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Optional explicit test name. If None, fn.name is used. |
None
|
overwrite
|
bool
|
If True, allow overriding an existing test name. |
False
|
params_model
|
type[BaseModel] | None
|
Optional Pydantic model to validate |
None
|
Source code in src/fastflowtransform/decorators.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |