I'm working a script that should pull down only the most recently created records (from within the past hour) from a hosted feature layer.
(1) Customer creates a new record to the feature layer via a Survey123 submission
(2) Script runs hourly to export any new records and pulls this record down to save to a local SQL Server DB
What I have been able to do so far:
(1) Get item content and export all features to a CSV via a ZIP folder to the local machine
(2) Unzip the folder, remove the CSV Collection from AGOL and delete the ZIP folder locally, leaving the local CSV
However, this is where I start to have the problem.
I will manually modify the feature layer (add in a polygon), allow the feature layer to save, verify in the feature layer properties that it recognizes the modification, and then run the script, but the modification isn't recognized.
I am not sure if it's because I live in the Central time zone and the then_ts variable is simply converting Central time to UTC while uwfBuildings is strictly UTC or what, but it's doing my head in.
If I change the seconds variable for then to (3600*4) - for four hours ago - it will recognize that a change has been made, even though the change I made last was 30 min ago:
I'm concerned that it is not possible to get the time resolution for the last modification for a feature layer to within an hour. If there is, how?
Also, concerning the export method, even if I get this to work, how can I pull specific records from the feature layer that match the criteria? What WHERE clause could be used to identify new records if the feature layer isn't time-enabled (see below - the WHERE clause would go after the export_format parameter)?
Thanks so much for any and all help!