Hello. I am trying to get data from my AGOL account and insert it into an enterprise database (SQL Server). I get the data via the ArcREST API from my AGOL table. I then use an arcpy.da InsertCursor to insert the data into a standalone table.
I am get an error on insert when the AGOL data contains a date field. The error message is "OverflowError: Python int too large to convert to C long".
How can i use the arcypy InsertCursor to insert date data? Do i need to convert the 'ticks' that are returned from AGOL into a string date, e.g. '2017-09011' or some such?
Thanks.
Solved! Go to Solution.
Hi Dan. Thanks for your reply.
I had seen the SO article you referred to and and had verified that my system maxsize was sufficient to cover the date ticks from the AGOL data (I am using python 3.x).
I did stumble upon a solution to the problem, however. I used a method from the ArcREST API
arcrest.common.spatial.toDateTime()
to convert the ticks to a python date time object. I then used that new datetime object in the InsertCursor. So far, its working as expected.
Thanks again for your suggestion.
check your system https://stackoverflow.com/questions/38314118/overflowerror-python-int-too-large-to-convert-to-c-long...
And you are using python 2.7.x... moving to python 3 removes this distinction https://bugs.python.org/issue21816
There are thousands of links to this, some relate to using itertools.count in place of xrange (old python 2.7), but I suspect you are going to have to check sys.maxint with your values or perform the same work in Pro (uses python 3.5.x)
Hi Dan. Thanks for your reply.
I had seen the SO article you referred to and and had verified that my system maxsize was sufficient to cover the date ticks from the AGOL data (I am using python 3.x).
I did stumble upon a solution to the problem, however. I used a method from the ArcREST API
arcrest.common.spatial.toDateTime()
to convert the ticks to a python date time object. I then used that new datetime object in the InsertCursor. So far, its working as expected.
Thanks again for your suggestion.