Skip to content

Commit

Permalink
feat: added lineage item and lineage entities (#90)
Browse files Browse the repository at this point in the history
* added lineage item and lineage entities

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* lint fixes

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* added BAdge for badge list

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* small change to lineage schema

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* whitespace

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* rename

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>
  • Loading branch information
allisonsuarez authored Feb 23, 2021
1 parent 3b71ebb commit f1c6011
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions amundsen_common/models/lineage.py
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
depth: int # how many levels up/down 0 == all
upstream_entities: List[LineageItem] # list of upstream entities
downstream_entities: List[LineageItem] # list of downstream entities


class LineageSchema(AttrsSchema):
target = Lineage
register_as_scheme = True

0 comments on commit f1c6011

Please sign in to comment.