cancel
Showing results for 
Search instead for 
Did you mean: 

How to call model_id list?

How to call model_id list?

Hello.

 

Could you give some sample python code to look for the project's model id list? 

I found a R sample code.

https://community.datarobot.com/t5/tips-and-tricks/using-r-api-to-access-the-repository-and-leaderbo...

 

I want to get a python code to call a model list with model id.

I always appreciate this community board.

 

Your answers are very helpful to me.

Thank you.

Labels (2)
0 Kudos
1 Solution

Accepted Solutions

Hello,

I believe what you might want is `get_models()` method on the `Project` class.

 

Here are the docs (for the latest client version, 3.0.2):

https://datarobot-public-api-client.readthedocs-hosted.com/en/v3.0.2/autodoc/api_reference.html#data...

 

There is an "examples" section in the docs for that method but a very simple version is as follows:

 

 

project_id = <YOU_PROJECT_ID>
models = Project.get(project_id).get_models()

 

 

And if you want just the model IDs you can use list comprehension in addition to the code above (using `models` variable):

 

model_ids = [model.id for model in models]

 

 

Hopefully that helps and is what you're looking for.

View solution in original post

0 Kudos
1 Reply

Hello,

I believe what you might want is `get_models()` method on the `Project` class.

 

Here are the docs (for the latest client version, 3.0.2):

https://datarobot-public-api-client.readthedocs-hosted.com/en/v3.0.2/autodoc/api_reference.html#data...

 

There is an "examples" section in the docs for that method but a very simple version is as follows:

 

 

project_id = <YOU_PROJECT_ID>
models = Project.get(project_id).get_models()

 

 

And if you want just the model IDs you can use list comprehension in addition to the code above (using `models` variable):

 

model_ids = [model.id for model in models]

 

 

Hopefully that helps and is what you're looking for.

0 Kudos