Issue Summary

The following code does not work with python datasource and returns an error

def test(a):
    return a
print(test(1)) # No1
print(map(lambda v: test(v), [1,2,3])) # No2
print(list(map(lambda v: test(v), [1,2,3]))) # No3
print([test(v) for v in [1,2,3]]) # No4

No3, 4 will say Error running query: <class ‘NameError’> name ‘test’ is not defined.

Running the same code from Redash OS works fine. (same python version)
Why does such a difference occur?

Technical details:

  • Redash Version:10.1.0
  • Browser/OS:Chrome/Ubuntu16.04.6 LTS
  • How did you install Redash:build docker-compose