Keep only rows that meet the condition

Solved!
mntintchui
Level 1
Keep only rows that meet the condition
Hello my name is Michael and I am new to DSS.

Here is variable i create

{
"v_date_m_1": "01-01-2020",
"v_date_m_3": "01-10-2019"
}

then in the PySpark recipe i do this:

SELECT *

FROM `table`
where date >= '${v_date_m_3}' and date < '${v_date_m_1}' ;

But nothing in output.
Can you guys tell me what is wrong ?


 

 

1 Solution
Jediv
Dataiker

Hi Michael,

you need to grab your variable before you can use it, like so:

import dataiku
print "I am filtering %s" % (dataiku.get_custom_variables()["v_date_m_1"])

https://doc.dataiku.com/dss/latest/advanced/variables_expansion.html#python

View solution in original post

2 Replies
Jediv
Dataiker

Hi Michael,

you need to grab your variable before you can use it, like so:

import dataiku
print "I am filtering %s" % (dataiku.get_custom_variables()["v_date_m_1"])

https://doc.dataiku.com/dss/latest/advanced/variables_expansion.html#python

mntintchui
Level 1
Author

Thanks Jediv!

0 Kudos