sql_recommendations
sql_recommendations ¶
Recommendations and assumptions for Magic ETL SQL conversion, loaded from YAML.
Package defaults ship in sql_recommendations.yaml. A project passes its own file of the same
shape to load_recommendations. Config only: a rule sets a directive, there are no custom tile
handler classes.
Resolution order for one directive on one tile, most to least specific: action type plus operation, action type, operation, default. Within a level a project rule beats a package rule.
Recommendation
dataclass
¶
Recommendation(
id: str,
directive: str,
value: Any,
why: str,
source: str,
action_type: str | None = None,
operation: str | None = None,
)
One rule: set directive to value for tiles matching action_type/operation.
level
property
¶
level: int
0 = action type + operation, 1 = action type, 2 = operation, 3 = default.
RecommendationConfigError ¶
Bases: ValueError
A recommendations YAML file is malformed.
RecommendationSet
dataclass
¶
RecommendationSet(rules: tuple[Recommendation, ...])
The rules in force for one conversion run.
resolve ¶
resolve(
action_type: str, operation: str | None, directive: str
) -> Recommendation | None
Return the most specific rule for directive, or None when no rule matches.
Source code in src/crew_dcs/classes/DomoDataflow/action/sql_recommendations.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
load_recommendations ¶
load_recommendations(
project_path: Path | str | None = None,
*,
package_path: Path | str | None = None,
include_defaults: bool = True,
) -> RecommendationSet
Load package defaults and an optional project override file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path | str | None
|
Project override YAML. Must exist when given. |
None
|
package_path
|
Path | str | None
|
Replace the shipped defaults file (used by tests and forks). |
None
|
include_defaults
|
bool
|
False loads only |
True
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
a given path does not exist. |
RecommendationConfigError
|
a file is malformed. |
Source code in src/crew_dcs/classes/DomoDataflow/action/sql_recommendations.py
181 182 183 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 | |