Skip to content

Commit

Permalink
🐛 account for contextless rendering in dbt codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Apr 18, 2023
1 parent 0d35fe2 commit d48e814
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changes/0.5.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.5.1 - 2023-04-18
### Fixed
* Account for "contextless" rendering in dbt codebase by supplying a default implementation for each variation matching var
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## 0.5.1 - 2023-04-18
### Fixed
* Account for "contextless" rendering in dbt codebase by supplying a default implementation for each variation matching var

## 0.5.0 - 2023-04-17
### Changed
* Translate all feature flag calls to var calls in the event no provider is used. This allows users to manage feature flags locally and seamlessly transition between that model and a dedicated provider.
Expand Down
8 changes: 4 additions & 4 deletions dbt_feature_flags/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def _wrapped(
native: bool = False,
):
if client is _MOCK_CLIENT:
ctx["feature_flag"] = ctx["var"]
ctx["feature_flag_str"] = ctx["var"]
ctx["feature_flag_num"] = ctx["var"]
ctx["feature_flag_json"] = ctx["var"]
ctx["feature_flag"] = ctx.get("var", lambda _, default=False: default)
ctx["feature_flag_str"] = ctx.get("var", lambda _, default="": default)
ctx["feature_flag_num"] = ctx.get("var", lambda _, default=0: default)
ctx["feature_flag_json"] = ctx.get("var", lambda _, default={}: default)
else:
ctx["feature_flag"] = client.bool_variation
ctx["feature_flag_str"] = client.string_variation
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dbt-feature-flags"
version = "0.5.0"
version = "0.5.1"
description = "Use feature flags in dbt models"
authors = ["z3z1ma <[email protected]>"]
include = ["zzz_dbt_feature_flags.pth"]
Expand Down

0 comments on commit d48e814

Please sign in to comment.