Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

From dataiku API how to access to SQL Probe code

Solved!
oscieux
Level 1
From dataiku API how to access to SQL Probe code

Hi all,

My question is in the subject ๐Ÿ™‚

Do anyone have a solution please?

0 Kudos
1 Solution
AlexT
Dataiker

Hi @oscieux ,

You can use the get_dataset() get_settings() get_raw() to retrieve SQL Probe code:

import dataiku
import pprint
pp = pprint.PrettyPrinter(indent=4)
client = dataiku.api_client()
project = client.get_default_project()

dataset = project.get_dataset("IMPORT_FROM_V5_sql_bad")
settings = dataset.get_settings()
params = settings.get_raw()['metrics']['probes']
for i in params:
    if i['type'] == 'sql_query':
        pp.pprint(i['configuration']['code'])

Screenshot 2022-03-24 at 10.32.58.png

 Let me know if that's what you were looking for!

View solution in original post

0 Kudos
2 Replies
AlexT
Dataiker

Hi @oscieux ,

You can use the get_dataset() get_settings() get_raw() to retrieve SQL Probe code:

import dataiku
import pprint
pp = pprint.PrettyPrinter(indent=4)
client = dataiku.api_client()
project = client.get_default_project()

dataset = project.get_dataset("IMPORT_FROM_V5_sql_bad")
settings = dataset.get_settings()
params = settings.get_raw()['metrics']['probes']
for i in params:
    if i['type'] == 'sql_query':
        pp.pprint(i['configuration']['code'])

Screenshot 2022-03-24 at 10.32.58.png

 Let me know if that's what you were looking for!

0 Kudos
oscieux
Level 1
Author

U are the best ๐Ÿ™‚
Thxs a lot !

0 Kudos