Compare project

Solved!
thomaslprru
Level 2
Compare project

Hi, 

 

I just want to know if there is an efficient way to compare two projects ? 

I want to duplicate a project only if this project isn't yet duplicated, is there a method to do this easily or I have to create my own method and compare different informations like project size, dataset name, etc. 

 

Thanks in advance,

 

Respectfully,

Thomas


Operating system used: Windows

0 Kudos
1 Solution
ZachM
Dataiker

Hi @thomaslprru,

You can check the project's timeline to determine if it was duplicated from another project.

If the project was duplicated, the first item in the timeline will be a PROJECT_DUPLICATE action.

The following code will get the first item in a project's timeline:

import dataiku

client = dataiku.api_client()

project = client.get_project("COPYOFPROJECT")
# You might need to increase item_count if your project has a lot of changes
timeline = project.get_timeline(item_count=100)

first_action = timeline["items"][-1]
print(first_action)

 

Example output:

{
    "user": "admin",
    "action": "PROJECT_DUPLICATE",
    "projectKey": "COPYOFMYPROJECT",
    "objectType": "PROJECT",
    "objectId": "MYPROJECT",
    "details": {
        "objectDisplayName": "Copy of my-project",
        "userDisplayName": "Administrator",
    },
    "time": 1671495995119
}

 

Thanks,

Zach

View solution in original post

1 Reply
ZachM
Dataiker

Hi @thomaslprru,

You can check the project's timeline to determine if it was duplicated from another project.

If the project was duplicated, the first item in the timeline will be a PROJECT_DUPLICATE action.

The following code will get the first item in a project's timeline:

import dataiku

client = dataiku.api_client()

project = client.get_project("COPYOFPROJECT")
# You might need to increase item_count if your project has a lot of changes
timeline = project.get_timeline(item_count=100)

first_action = timeline["items"][-1]
print(first_action)

 

Example output:

{
    "user": "admin",
    "action": "PROJECT_DUPLICATE",
    "projectKey": "COPYOFMYPROJECT",
    "objectType": "PROJECT",
    "objectId": "MYPROJECT",
    "details": {
        "objectDisplayName": "Copy of my-project",
        "userDisplayName": "Administrator",
    },
    "time": 1671495995119
}

 

Thanks,

Zach