:doc:`SageMaker <../../sagemaker>` / Client / query_lineage

*************
query_lineage
*************



.. py:method:: SageMaker.Client.query_lineage(**kwargs)

  

  Use this action to inspect your lineage and discover relationships between entities. For more information, see `Querying Lineage Entities <https://docs.aws.amazon.com/sagemaker/latest/dg/querying-lineage-entities.html>`__ in the *Amazon SageMaker Developer Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/QueryLineage>`_  


  **Request Syntax**
  ::

    response = client.query_lineage(
        StartArns=[
            'string',
        ],
        Direction='Both'|'Ascendants'|'Descendants',
        IncludeEdges=True|False,
        Filters={
            'Types': [
                'string',
            ],
            'LineageTypes': [
                'TrialComponent'|'Artifact'|'Context'|'Action',
            ],
            'CreatedBefore': datetime(2015, 1, 1),
            'CreatedAfter': datetime(2015, 1, 1),
            'ModifiedBefore': datetime(2015, 1, 1),
            'ModifiedAfter': datetime(2015, 1, 1),
            'Properties': {
                'string': 'string'
            }
        },
        MaxDepth=123,
        MaxResults=123,
        NextToken='string'
    )
    
  :type StartArns: list
  :param StartArns: 

    A list of resource Amazon Resource Name (ARN) that represent the starting point for your lineage query.

    

  
    - *(string) --* 

    

  :type Direction: string
  :param Direction: 

    Associations between lineage entities have a direction. This parameter determines the direction from the StartArn(s) that the query traverses.

    

  
  :type IncludeEdges: boolean
  :param IncludeEdges: 

    Setting this value to ``True`` retrieves not only the entities of interest but also the `Associations <https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking-entities.html>`__ and lineage entities on the path. Set to ``False`` to only return lineage entities that match your query.

    

  
  :type Filters: dict
  :param Filters: 

    A set of filtering parameters that allow you to specify which entities should be returned.

     

    
    * Properties - Key-value pairs to match on the lineage entities' properties.
     
    * LineageTypes - A set of lineage entity types to match on. For example: ``TrialComponent``, ``Artifact``, or ``Context``.
     
    * CreatedBefore - Filter entities created before this date.
     
    * ModifiedBefore - Filter entities modified before this date.
     
    * ModifiedAfter - Filter entities modified after this date.
    

    

  
    - **Types** *(list) --* 

      Filter the lineage entities connected to the ``StartArn`` by type. For example: ``DataSet``, ``Model``, ``Endpoint``, or ``ModelDeployment``.

      

    
      - *(string) --* 

      
  
    - **LineageTypes** *(list) --* 

      Filter the lineage entities connected to the ``StartArn``(s) by the type of the lineage entity.

      

    
      - *(string) --* 

      
  
    - **CreatedBefore** *(datetime) --* 

      Filter the lineage entities connected to the ``StartArn``(s) by created date.

      

    
    - **CreatedAfter** *(datetime) --* 

      Filter the lineage entities connected to the ``StartArn``(s) after the create date.

      

    
    - **ModifiedBefore** *(datetime) --* 

      Filter the lineage entities connected to the ``StartArn``(s) before the last modified date.

      

    
    - **ModifiedAfter** *(datetime) --* 

      Filter the lineage entities connected to the ``StartArn``(s) after the last modified date.

      

    
    - **Properties** *(dict) --* 

      Filter the lineage entities connected to the ``StartArn``(s) by a set if property key value pairs. If multiple pairs are provided, an entity is included in the results if it matches any of the provided pairs.

      

    
      - *(string) --* 

      
        - *(string) --* 

        
  

  
  :type MaxDepth: integer
  :param MaxDepth: 

    The maximum depth in lineage relationships from the ``StartArns`` that are traversed. Depth is a measure of the number of ``Associations`` from the ``StartArn`` entity to the matched results.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    Limits the number of vertices in the results. Use the ``NextToken`` in a response to to retrieve the next page of results.

    

  
  :type NextToken: string
  :param NextToken: 

    Limits the number of vertices in the request. Use the ``NextToken`` in a response to to retrieve the next page of results.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Vertices': [
              {
                  'Arn': 'string',
                  'Type': 'string',
                  'LineageType': 'TrialComponent'|'Artifact'|'Context'|'Action'
              },
          ],
          'Edges': [
              {
                  'SourceArn': 'string',
                  'DestinationArn': 'string',
                  'AssociationType': 'ContributedTo'|'AssociatedWith'|'DerivedFrom'|'Produced'|'SameAs'
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Vertices** *(list) --* 

        A list of vertices connected to the start entity(ies) in the lineage graph.

        
        

        - *(dict) --* 

          A lineage entity connected to the starting entity(ies).

          
          

          - **Arn** *(string) --* 

            The Amazon Resource Name (ARN) of the lineage entity resource.

            
          

          - **Type** *(string) --* 

            The type of the lineage entity resource. For example: ``DataSet``, ``Model``, ``Endpoint``, etc...

            
          

          - **LineageType** *(string) --* 

            The type of resource of the lineage entity.

            
      
    
      

      - **Edges** *(list) --* 

        A list of edges that connect vertices in the response.

        
        

        - *(dict) --* 

          A directed edge connecting two lineage entities.

          
          

          - **SourceArn** *(string) --* 

            The Amazon Resource Name (ARN) of the source lineage entity of the directed edge.

            
          

          - **DestinationArn** *(string) --* 

            The Amazon Resource Name (ARN) of the destination lineage entity of the directed edge.

            
          

          - **AssociationType** *(string) --* 

            The type of the Association(Edge) between the source and destination. For example ``ContributedTo``, ``Produced``, or ``DerivedFrom``.

            
      
    
      

      - **NextToken** *(string) --* 

        Limits the number of vertices in the response. Use the ``NextToken`` in a response to to retrieve the next page of results.

        
  
  **Exceptions**
  
  *   :py:class:`SageMaker.Client.exceptions.ResourceNotFound`

  