-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for custom grain (#55)
* feat: add functionality to deprecate attributes This commit adds a new `BaseModel.DEPRECATED` key that can be added to the dataclasses `metadata` dict to indicate that this field is deprecated. * feat: new `DeprecatedMixin` for whole classes This commit introduces a new `DeprecatedMixin` class that can be added to any model class to mark that class as deprecated. It will throw a warning if the user tries to instantiate the class. * feat: mark `TimeGranularity` as deprecated Since we introduced custom grains, the old `queryable_granularities` is deprecated in favor of the new `queryable_time_granilarities`, which is just a simple list of strings. This commit marks the `TimeGranularity` class and all granularity fields that return it as deprecated. * fix: change `OrderByGroupBy` to use `str` as grain This commit changes the `OrderByGroupBy` class to use `str` instead of the deprecated `TimeGranularity` enum as its input grain. We can do this without a deprecation because we haven't released the SDK since the order by refactor, so we can just change it. * docs: changelog entry * fix: preload models in `__init__` We need to call `BaseModel._register_subclasses` otherwise models will fail to use `camelCase` and raise deprecation warnings. That is done in `dbtsl.models.__init__`. If the user never explicitly imports that, this won't get called, and they might get an error. This fixes that by adding an explicit call to it on the library init. * fix: catch deprecation warnings in GQL client We are raising deprecation warnings from the GQL client when we instantiate the models. To avoid the warning spam, we filter those warnings out. They should only be display if the user uses any deprecated class, not us.
- Loading branch information
1 parent
9896a1c
commit 7ab6312
Showing
17 changed files
with
173 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Deprecations | ||
body: Deprecate `TimeGranularity` enum and all other fields that used it | ||
time: 2024-10-17T16:31:58.091095+02:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Features | ||
body: Add support for custom time granularity | ||
time: 2024-10-17T16:30:57.023867+02:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Under the Hood | ||
body: Add new mechanisms to deprecate fields and classes | ||
time: 2024-10-17T16:30:37.793294+02:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters