I have a script that automatically updates a sync enabled sde feature class. I populate the last_edited_date field with datetime.now(). This has worked for over a year until last week. All of a sudden I'm getting this error RuntimeError: The value type is incompatible with the field type. [last_edited_date]. Not sure what's going on. The date field in the feature class is in this format: %m/%d/%Y %H:%M%p or 1/28/2021 1:05 PM.
Datetime.now() prints this format: 2021-01-28 13:06:30.180737
Solved! Go to Solution.
Finally figured this out. I'm updating two nearly identical datasets, one for the web and one in local projection for printed maps. The local dataset lacks a Global ID field, so the indexs were off by one and the script was trying to put a date in a non-date field. It's strange that this hasn't been an issue before.
did you perhaps switch from python 2.7 to 3.x (aka arcmap to arcgis pro, or within SDE)
As for the international formatting issue, you now have nanosecond precision.
datetime — Basic date and time types — Python 3.9.1 documentation just select the 3.7 docs when you are there for changes if this is your case
Nothing changed. The script runs every Monday and it errored out this week.
What RDBMS are you using and what release of ArcGIS Enterprise are you using as well?
As far as the sde database management, I’m doing it all in Pro. We’re on enterprise 10.7.1.
Thx for the info on ArcGIS Pro and ArcGIS Enterprise 10.7.1. Are you using Oracle, SQL Server, PostgreSQL, etc for your RDMBS?
Sorry, SQL Server.
FAQ: What version of Python is used in ArcGIS? (esri.com) which python is default?
I’m on Pro 2.7, so Python 3.7.9
its more the server side that I was wondering, not Pro
f = '%m/%d/%Y %H:%M%p'
nw = datetime.datetime.now()
nw.strftime(f)
'01/28/2021 19:19PM'