-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create metricflow-semantics
Package
#1151
Changes from 76 commits
34bb6ff
86420c6
f208ee1
c75352d
678b993
e50a1e5
8929eec
614f0e7
2b2ea34
8657abf
38f689e
e9e04f4
91529ec
248474b
c952eb0
0cc46a3
4f28202
64cad82
fb53b89
d6cbc72
02eda1b
e1160dd
d80ebc3
246b3b0
c7f6a04
298b45e
d2cd7be
5de0abd
be48a6d
68875ee
8724f02
9c094dc
73580a4
249cd1b
89bef6f
e629e9d
471a7bd
33752c7
fce72e9
2ef2163
77bd647
cfc2eef
58f631c
51431b2
9173de7
f88ad4e
be48ed5
d2094c0
7c17c1e
f755143
5426a61
3d9aba3
2b87c74
0313849
d6d3cfc
d58a953
4c9dda2
3e349ff
7e9ee2c
00129ac
6f21bb7
b988db5
3da1773
76119b6
ec9d092
9b468a9
d201599
ae485c0
742b85b
d80bf8a
1699579
dbf35f8
f9d3544
b853369
d54a4ad
4afbd09
f6f64cb
9e2c131
60773a9
47d7057
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Create `metricflow-semantics` package. | ||
time: 2024-04-24T14:59:49.8435-07:00 | ||
custom: | ||
Author: plypaul | ||
Issue: "1150" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved. | ||
“Business Source License” is a trademark of MariaDB Corporation Ab. | ||
|
||
Licensed Work: dbt MetricFlow | ||
|
||
Change Date: The change date for each release of the Licensed Work will | ||
be the 3rd anniversary of the initial release date of that | ||
release of the Licensed Work. | ||
|
||
Change License: Apache 2.0 https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Additional Use Grant: The Licensor hereby grants you the right to use the | ||
Licensed Work for production purposes that consist of | ||
your internal business purposes, but not for the purpose | ||
of providing managed services or software-as-a-service | ||
to others. | ||
|
||
Terms | ||
|
||
The Licensor hereby grants you the right to copy, modify, create derivative | ||
works, redistribute, and make non-production use of the Licensed Work. The | ||
Licensor may make an Additional Use Grant, above, permitting limited production | ||
use. | ||
|
||
Effective on the Change Date, or the fourth anniversary of the first publicly | ||
available distribution of a specific version of the Licensed Work under this | ||
License, whichever comes first, the Licensor hereby grants you rights under the | ||
terms of the Change License, and the rights granted in the paragraph above | ||
terminate. | ||
|
||
If your use of the Licensed Work does not comply with the requirements currently | ||
in effect as described in this License, you must purchase a commercial license | ||
from the Licensor, its affiliated entities, or authorized resellers, or you must | ||
refrain from using the Licensed Work. | ||
|
||
All copies of the original and modified Licensed Work, and derivative works of | ||
the Licensed Work, are subject to this License. This License applies separately | ||
for each version of the Licensed Work and the Change Date may vary for each | ||
version of the Licensed Work released by Licensor. | ||
|
||
You must conspicuously display this License on each original or modified copy of | ||
the Licensed Work. If you receive the Licensed Work in original or modified form | ||
from a third party, the terms and conditions set forth in this License apply to | ||
your use of that work. | ||
|
||
Any use of the Licensed Work in violation of this License will automatically | ||
terminate your rights under this License for the current and all other versions | ||
of the Licensed Work. | ||
|
||
This License does not grant you any right in any trademark or logo of Licensor | ||
or its affiliates (provided that you may use a trademark or logo of Licensor as | ||
expressly required by this License).TO THE EXTENT PERMITTED BY APPLICABLE LAW, | ||
THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL | ||
WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) | ||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, | ||
NON-INFRINGEMENT, AND TITLE.MariaDB hereby grants you permission to use this | ||
License’s text to license your works, and to refer to it using the trademark | ||
“Business Source License”, as long as you comply with the Covenants of Licensor | ||
below. | ||
|
||
Covenants of Licensor | ||
|
||
In consideration of the right to use this License’s text and the “Business | ||
Source License” name and trademark, Licensor covenants to MariaDB, and to all | ||
other recipients of the licensed work to be provided by Licensor: | ||
|
||
To specify as the Change License the GPL Version 2.0 or any later version, or a | ||
license that is compatible with GPL Version 2.0 or a later version, where | ||
“compatible” means that software provided under the Change License can be | ||
included in a program with software provided under GPL Version 2.0 or a later | ||
version. Licensor may specify additional Change Licenses without limitation. | ||
|
||
To either: (a) specify an additional grant of rights to use that does not impose | ||
any additional restriction on the right granted in this License, as the | ||
Additional Use Grant; or (b) insert the text “None”. | ||
|
||
To specify a Change Date. | ||
|
||
Not to modify this License in any other way. | ||
|
||
Notice | ||
|
||
The Business Source License (this document, or the “License”) is not an Open | ||
Source license. However, the Licensed Work will eventually be made available | ||
under an Open Source License, as stated in this License. | ||
|
||
For more information on the use of the Business Source License for MariaDB | ||
products, please visit the MariaDB Business Source License FAQ. For more | ||
information on the use of the Business Source License generally, please visit | ||
the Adopting and Developing Business Source License FAQ. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<p align="center"> | ||
<a target="_blank" href="https://twitter.com/dbt_labs"> | ||
<img src="https://img.shields.io/twitter/follow/dbt_labs?labelColor=image.png&color=163B36&logo=twitter&style=flat"> | ||
</a> | ||
<a target="_blank" href="https://www.getdbt.com/community/"> | ||
<img src="https://img.shields.io/badge/Slack-join-163B36"> | ||
</a> | ||
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" /></a> | ||
</p> | ||
|
||
# Welcome to metricflow-semantics | ||
|
||
This repo encapsulates the modules needed for semantic resolution for MetricFlow queries. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a package, not a repo, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
|
||
## Repo use cases | ||
- Resolving the dbt model dependencies of a (saved) query in MetricFlow for DAG dependency management. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. We might want to make this more general. If you've got an idea now that's great otherwise we can revisit later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No ideas at the moment. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
from pydantic import BaseModel | ||
|
||
from metricflow.mf_logging.formatting import indent | ||
from metricflow_semantics.mf_logging.formatting import indent | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -36,7 +36,8 @@ def __init__( | |
|
||
@staticmethod | ||
def _is_pydantic_base_model(obj: Any): # type:ignore | ||
return isinstance(obj, BaseModel) | ||
# Checking the attribute as the BaseModel check fails for newer version of Pydantic. | ||
return isinstance(obj, BaseModel) or hasattr(obj, "__config__") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's risky but I guess it's ok in this context. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't figure out a good solution after a few minutes of searching, but yeah, I'm looking for a better solution. |
||
|
||
def _handle_sequence_obj(self, list_like_obj: Union[list, tuple], remaining_line_width: Optional[int]) -> str: | ||
"""Pretty prints a sequence object i.e. list or tuple. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
micro-nit: I'd call this Under the Hood since that's what it is from the perspective of MetricFlow users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.