Within AGOL Notebook I'm trying to query a date field in my feature layer and am having difficulty nailing down the correct syntax for the Where clause.
I'm trying to get all features that have been updated (edited) in the last week from the day the script is run.
Below is what I currently have in the Notebook cell for setting up the date variable (to be one week ago) and running the feature layer query code. The code fails on the line with the query and I'm sure it has to do with the where clause. "timestamp" was a recent addition and I definitely am not sure if it belongs in the clause.
I've verified that my lastWeek variable gets the correct date value.
now = datetime.datetime.now()
lastWeek = now - datetime.timedelta(days = 7)
query_result1 = addr_fl.query(where="LASTUPDATE >= timestamp 'lastWeek'", out_fields='LOCID,ACTIVE,ADDRESS,LASTUPDATE')
Any help with this where clause syntax would be much appreciated.