Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/sagemaker/lineage/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ def __eq__(self, other):
and self.destination_arn == other.destination_arn
)

def __str__(self):
"""Define string representation of ``Edge``.

Format:
{
'source_arn': 'string', 'destination_arn': 'string',
'association_type': 'string'
}

"""
return (str(self.__dict__))


class Vertex:
"""A vertex for a lineage graph."""
Expand Down Expand Up @@ -130,6 +142,19 @@ def __eq__(self, other):
and self.lineage_source == other.lineage_source
)

def __str__(self):
"""Define string representation of ``Vertex``.

Format:
{
'arn': 'string', 'lineage_entity': 'string',
'lineage_source': 'string',
'_session': <sagemaker.session.Session object>
}

"""
return (str(self.__dict__))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this look like?


def to_lineage_object(self):
"""Convert the ``Vertex`` object to its corresponding lineage object.

Expand Down Expand Up @@ -199,6 +224,32 @@ def __init__(
if vertices is not None:
self.vertices = vertices

def __str__(self):
"""Define string representation of ``LineageQueryResult``.

Format:
{
'edges':[
{
'source_arn': 'string', 'destination_arn': 'string',
'association_type': 'string'
},
...
]
'vertices':[
{
'arn': 'string', 'lineage_entity': 'string',
'lineage_source': 'string',
'_session': <sagemaker.session.Session object>
},
...
]
}

"""
result_dict = vars(self)
return (str({k: [vars(val) for val in v] for k, v in result_dict.items()}))


class LineageFilter(object):
"""A filter used in a lineage query."""
Expand Down