Skip to main content

Using python sdk can we read particular version of pipeline like if pipeline has two version then can we read first version.

 

this line 
pipeline=sch.pipelines.get(name="Test")

gives latest version only can we get previous version also.

@himanshu1234567 

 

Can you please try the below code snippet and check if it helps.

 

# Get the history of the pipeline

pipeline_history = client.get_pipeline_history('pipeline_name')

# Get the previous version of the pipeline

previous_pipeline = pipeline_historyt1]

# Print information about the previous pipeline

print("Previous pipeline version:", previous_pipelinel'version'])


@himanshu1234567 

Another way is to get the latest version of your pipeline like you mentioned in the sample code:

 

pipeline=sch.pipelines.get(name="Test")

You can now use

pipeline.commits

This will list all the commits for this pipeline, you will see the commit_id and also the version number for each commit.

 

So if you want version=1, select the commit_id for that version and use this code to get the reference to the pipeline

pipeline=sch.pipelines.get(commit_id="YOUR COMMIT_ID")

 


Reply