SYS username mapped to Snowflake Connection

sj0071992
sj0071992 Partner, Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2022, Neuron 2023 Posts: 131 Neuron

Hi Team,

I am looking for an API which will help me to extract the Connection Details of all Dataiku projects and the username mapped to it.

Basically i am looking for Snowflake connection and SYS username mapped to it in all the Dataiku projects.

Is it possible to extract these details?

Thanks in Advance

Tagged:

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,215 Dataiker
    edited July 17

    Hi,

    You can list all connections from all projects if that is what you are looking for using :

    import dataiku
    import pandas as pd, numpy as np
    import pprint
    
    pp = pprint.PrettyPrinter(indent=4)
    
    connections = client.list_connections()
    #pp.pprint(dss_connections)
    
    for connection in connections:
        connections[connection] = client.get_connection(connection)
        connection_definition = connections[connection].get_definition()
        try:
            if connection_definition['type'] == 'Snowflake' and connection_definition['params']['user'] == 'SYS':
                print(connection_definition)
        except  Exception as e: print(e)

    This would list all the connections details where it's snowflake and username SYS.

    You can then print out the name of the connection and use the functionality found under :

    Administration - Monitoring - Per-connection data to find out their usage in a project.

    Please note you will need Admin privileges to list all connections.

  • sj0071992
    sj0071992 Partner, Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2022, Neuron 2023 Posts: 131 Neuron

    Hi Alex,

    This is perfect.

    Can we also add warehouse details in the same code?

    which warehouse is mapped to that connection.

    Thanks in advance

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,215 Dataiker

    Yes, you can simply use :

    connection_definition['params']['warehouse'] that will be the value of the warehouse you can filter of print as seen in the sample code.

    Let me know if you have any issues.

Setup Info
    Tags
      Help me…