Export user details as csv or excel

Level 1
Export user details as csv or excel

Hi all,
I was trying to export list of users in to an excel or export as CSV. I couldn't find an option under Administration->Security->Users. 

Tried exporting via dsscli command but the list doesnt have information if the user is enabled/disabled, last login , created date etc. 

Any other ways to get this?

Operating system used: RHEL

0 Kudos
1 Reply

Below is an example on how to get the list of users, if the user is enabled/disabled and their last login that is retrieved using function last_successful_login.

You can use a notebook to run below code and the output will be written to a CSV file called users.csv located in the folder tmp.

import dataiku

client = dataiku.api_client()
dss_users = client.list_users()

with open('/tmp/users.csv', 'w') as f:
    for user in dss_users:
        dss_user = client.get_user(user["login"])
        enabled = dss_user.get_settings().get_raw()["enabled"]
        last_login_date = dss_user.get_activity().last_successful_login
        print(user["login"]+","+ str(enabled) + "," +str(last_login_date)+"\r\n")
        f.write(user["login"]+","+ str(enabled) +"," +str(last_login_date)+"\r\n")


0 Kudos