Community Conundrums are live! Learn more

Keep only rows that meet the condition

Level 1
Keep only rows that meet the condition
Jump to solution
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 ?


 

 

2 Replies
Dataiker
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

Level 1
Author

Thanks Jediv!

0 Kudos