Experts, this is minor, but I am not able to just get it right.
+--------------+----------------------------------------------------------+-------------------+
|table |query |date |
+--------------+----------------------------------------------------------+-------------------+
|AGENT |select * from table where DW_EFFECTIVE_DATE_PARTITION ='X'|2019-12-24 00:00:00|
+--------------+----------------------------------------------------------+-------------------+
All I want in this dataframe is to change column query to:
select * from table where DW_EFFECTIVE_DATE_PARTITION ='2019-12-24 00:00:00'
I tried:
>>> dfX.withColumn('query',regexp_replace('query',"'X'","'" + dfX['d'] + "'")).show()
Traceback (most recent call last):
TypeError: 'Column' object is not callable
Desired Output:
+--------------+----------------------------------------------------------------------------+-------------------+
|table |query |date |
+--------------+----------------------------------------------------------------------------+-------------------+
|AGENT |select * from table where DW_EFFECTIVE_DATE_PARTITION ='2019-12-24 00:00:00'|2019-12-24 00:00:00|
+--------------+----------------------------------------------------------------------------+-------------------+