<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238565#M8115</link>
    <description>&lt;P&gt;Curently, I am pulling all the data from the featurelayerid using the below script:&lt;/P&gt;&lt;P&gt;feature_layer_id = ' ' Inspform = gis.content.get(feature_layer_id) insp=Inspform.layers[0].query().sdf insp.to_sql('testtable',con=engine,schema=None,if_exists='replace',index=False,index_label=None,dtype=None,method=None)&lt;/P&gt;&lt;P&gt;The featurelayer has two fields with create date and edit date. would like to pull data where createdate or edit date is equal to sysdate.&lt;/P&gt;&lt;P&gt;How can i achieve this? I am new to python and Arcgis&lt;/P&gt;&lt;P&gt;I browsed some sample notebooks, but no luck&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 01:00:14 GMT</pubDate>
    <dc:creator>ChallagundlaSindhuraITS</dc:creator>
    <dc:date>2022-12-07T01:00:14Z</dc:date>
    <item>
      <title>How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238565#M8115</link>
      <description>&lt;P&gt;Curently, I am pulling all the data from the featurelayerid using the below script:&lt;/P&gt;&lt;P&gt;feature_layer_id = ' ' Inspform = gis.content.get(feature_layer_id) insp=Inspform.layers[0].query().sdf insp.to_sql('testtable',con=engine,schema=None,if_exists='replace',index=False,index_label=None,dtype=None,method=None)&lt;/P&gt;&lt;P&gt;The featurelayer has two fields with create date and edit date. would like to pull data where createdate or edit date is equal to sysdate.&lt;/P&gt;&lt;P&gt;How can i achieve this? I am new to python and Arcgis&lt;/P&gt;&lt;P&gt;I browsed some sample notebooks, but no luck&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 01:00:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238565#M8115</guid>
      <dc:creator>ChallagundlaSindhuraITS</dc:creator>
      <dc:date>2022-12-07T01:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238576#M8116</link>
      <description>&lt;P&gt;You probably just want feature_layer.query().&amp;nbsp; Take a look at the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#:~:text=The%20query%20method%20queries%20a%20FeatureLayer%20based%20on%20a%20sql%20statement." target="_self"&gt;docs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 01:25:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238576#M8116</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-12-07T01:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238578#M8117</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank You, I tried something like this, I dont want to hard code the date. It should be sysdate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;insp=Inspform.layers[0].query(where =" CreationDate &amp;gt; [datetime(2022, 10, 7)]").sdf ; I am trying to figure out the correct syntax&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 01:37:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238578#M8117</guid>
      <dc:creator>ChallagundlaSindhuraITS</dc:creator>
      <dc:date>2022-12-07T01:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238579#M8118</link>
      <description>&lt;P&gt;It's expecting a formatted date.&amp;nbsp; I do something similar to setup where clause for querying the last 24 hours on a feature layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from datetime import datetime, timedelta

last_24hour_date_time = datetime.now() - timedelta(hours = 24)
timestamp = last_24hour_date_time.strftime('%Y-%m-%d %H:%M:%S')
whereClause = "CreationDate&amp;gt;= '{}'".format(timestamp)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 02:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238579#M8118</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-12-07T02:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238590#M8119</link>
      <description>&lt;P&gt;Thank You James, The CreationDate format is&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2022-10-07 17:46:00.158999808&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried below statements , but no luck. Please Advise.&lt;/P&gt;&lt;P&gt;inspd=Inspform.layers[0].query(where = "CreationDate&amp;gt;= '{}'".format(timestamp)).sdf&lt;BR /&gt;inspd=Inspform.layers[0].query(where = "CreationDate&amp;gt;= '{}'".format(last_24hour_date_time)).sdf&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 03:15:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238590#M8119</guid>
      <dc:creator>ChallagundlaSindhuraITS</dc:creator>
      <dc:date>2022-12-07T03:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238593#M8120</link>
      <description>&lt;LI-CODE lang="python"&gt;last_24hour_date_time = datetime.now() - timedelta(hours = 24)
timestamp = last_24hour_date_time.strftime('%Y-%m-%d %H:%M:%S.%f')

nspd=Inspform.layers[0].query(where = "CreationDate&amp;gt;= '{}'".format(timestamp)).sdf&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Dec 2022 03:53:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1238593#M8120</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-12-07T03:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1239352#M8132</link>
      <description>&lt;P&gt;This statement also didn't work for me.&lt;/P&gt;&lt;P&gt;last_24hour_date_time = datetime.now() - timedelta(hours = 24)&lt;BR /&gt;timestamp = last_24hour_date_time.strftime('%Y-%m-%d %H:%M:%S.%f')&lt;BR /&gt;print(timestamp)&lt;/P&gt;&lt;PRE&gt;2022-12-07 14:44:34.257940&lt;/PRE&gt;&lt;P&gt;Do you think its because the milli seconds in the creationdate has 9 digits and the timestamp is showing 7 digits and its not getting compared ?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 20:00:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1239352#M8132</guid>
      <dc:creator>ChallagundlaSindhuraITS</dc:creator>
      <dc:date>2022-12-08T20:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1239359#M8133</link>
      <description>&lt;P&gt;That's why I added the "&lt;SPAN&gt;%f" in the strftime&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It's hard to say what's the issue.&amp;nbsp; I don't really undersrtand what the .sdf is about?&amp;nbsp; Likely issue is something other than datetime formats.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do this: go to the query task to your feature service and fill in the WHERE input parameter with what you think is correct.&amp;nbsp; If it works that's the formatting of your WHERE statement in your python script.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 20:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1239359#M8133</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2022-12-08T20:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the data from HostedFeatureLayer for today's date using python from ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1239476#M8134</link>
      <description>&lt;P&gt;Did a workaround other than where clause, Below script worked:&lt;/P&gt;&lt;P&gt;from datetime import datetime, timedelta&lt;/P&gt;&lt;P&gt;last_24hour_date_time = datetime.now() - timedelta(hours = 1200)&lt;BR /&gt;timestamp = last_24hour_date_time.strftime('%Y-%m-%d %H:%M:%S')&lt;BR /&gt;#print (timestamp) #2022-10-19 18:41:09&lt;BR /&gt;filterinsp = insp[insp['CreationDate'] &amp;gt;= timestamp] ### this worked to get all 24 hours data&lt;BR /&gt;filterinsp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 23:53:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-get-the-data-from-hostedfeaturelayer-for/m-p/1239476#M8134</guid>
      <dc:creator>ChallagundlaSindhuraITS</dc:creator>
      <dc:date>2022-12-08T23:53:34Z</dc:date>
    </item>
  </channel>
</rss>

