-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: added lineage item and lineage entities #90
Changes from 5 commits
e8c85bf
d7cf7d6
3c18437
aeaa79d
43b61e3
c21b731
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,37 @@ | ||
# Copyright Contributors to the Amundsen project. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from typing import Optional, List | ||
|
||
from amundsen_common.models.table import Badge | ||
|
||
import attr | ||
from marshmallow_annotations.ext.attrs import AttrsSchema | ||
|
||
|
||
@attr.s(auto_attribs=True, kw_only=True) | ||
class LineageItem: | ||
key: str # down/upstream table/col/task key | ||
level: int # upstream/downstream distance from current resource | ||
source: str # database this resource is from | ||
badges: Optional[List[Badge]] = None | ||
usage: Optional[int] = None # statistic to sort lineage items by | ||
|
||
|
||
class LineageItemSchema(AttrsSchema): | ||
target = LineageItem | ||
register_as_scheme = True | ||
|
||
|
||
@attr.s(auto_attribs=True, kw_only=True) | ||
class Lineage: | ||
key: str # current table/col/task key | ||
direction: str # upstream/downstream/both | ||
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. any reason we need direction and depth if we have 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. LineageItem seems to include level already? 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. Just to persist the selection (upstream, downstream, both) send over in the request. Similarly depth might be needed because it tells you how many levels were requested for this response. |
||
depth: int # how many levels up/down 0 == all | ||
lineage_entities_upstream: List[LineageItem] # list of upstream entities | ||
allisonsuarez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
lineage_entities_downstream: List[LineageItem] # list of downstream entities | ||
allisonsuarez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class LineageSchema(AttrsSchema): | ||
target = Lineage | ||
register_as_scheme = True |
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.
could you share some examples on this class? e.g what are the badges and usage using here?
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.
Just added the actual Badge class for badge list. Not sure what you mean by what the usage is using here?
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.
we can change
usage
to be even more general and make it something likesorting_metric
or something like that, but usage seems like a natural way in which we would want to highlight more important upstream/downstream resources when you have lots of themThere 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.
My question is around how the metadata lineage entity connection will look like with badge and usage.