Data source Python result form


#1

I have a question to the re:dash data source Python. Is it possible to create any Python script and return values to re:dash without calling any other query result? I saw in the Python example that there is a function called add_result_column() but I didn’t understand whether the result parameter must have a specific form or not. If so can you please tell me this specific data form?


#2

Yes, calling other query result is not mandatory, it was just an example.

You do need to set your result in the result variable and it’s needs to be in the format Redash understands.

See some more reference in this post: http://www.ehfeng.com/redash-python-functions/.


#4

Why does this simple python script not work?

def getData(count):
print "ID Nr. ", count
def getSession():
getData(2)

getSession()

I get the error ‘Error running query: <type ‘exceptions.NameError’> global name ‘getData’ is not defined’

Maybe somebody can help me.