The ExecuteDataLoad tool, when run in python at least, appears to overwrite the datetime module imported by import arcpy. This sample code hopefully describes the issue:
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> datetime
<SPAN class="comment token">#import datetime appears to be part of import arcpy</SPAN>
<SPAN class="comment token">#but for readability of code, you can include it, though it's redundant</SPAN>
<SPAN class="comment token">#even if we exclude "import datetime", the following line shows it imports the module</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>datetime<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#returns <module 'datetime' from 'C:\\...\\ESRI\\conda\\envs\\arcgispro-py3-clone\\lib\\datetime.py'></SPAN>
<SPAN class="comment token">#so you can do things like the following:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">.</SPAN>now<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Now lets run the data loading tools</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>dlt<SPAN class="punctuation token">.</SPAN>ExecuteDataLoad<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'...\dataloadingworkspace\DataReference.xlsx'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#However, after running the ExecuteDataLoad tool, datetime is modified, so now:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>datetime<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#returns <class 'datetime.datetime'></SPAN>
<SPAN class="comment token">#which means the code</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">.</SPAN>now<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#that previously worked, suddenly now</SPAN>
<SPAN class="comment token">#returns AttributeError: type object 'datetime.datetime' has no attribute 'datetime'</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The problem is, first off, this is confusing as can be, and makes reading/following the code rather confusing that there's an undocumented shift in what is defined as datetime. However, second, and more worrisome, is the fact that I have to assume import arcpy includes an import of datetime for a reason. What I'm getting at is, if arcpy assumes datetime will be the datetime module and calls like datetime.datetime.now() (and others) will work in that specific syntax. Then isn't there a potential that a tool, only callable within arcpy, modifying that core assumption, could cause issues with other parts of arcpy...?
Am I over-thinking this or missing something?