I'm using python as a data source in Redash, and I'm a little addicted to it, so I'll leave it.
I wanted to use the datetime
library imported at the beginning in the hoge
function as shown below.
import datetime
def hoge():
print(datetime.datetime.now())
hoge()
↓ An error occurred when Executed. (!?)
Error running query: <type 'exceptions.NameError'> global name 'datetime' is not defined
I imported it in the function and it worked.
def hoge():
import datetime
print(datetime.datetime.now())
hoge()
# -> [2020-02-12T09:59:05.617825] 2020-02-12 09:59:05.617767
Recommended Posts