Hi Brandon - thanks for the details here. See my responses below. Just to note, I did my testing using the FeatureSharingDraft class, which replaces the legacy CreateWebLayerSDDraft function. This may explain the differences seen with #1.
1) Null values and edit settings not being respected:
-I wasn't able to reproduce this, though I was testing from a FGDB instead of a view layer extracted from a SQL server database. In my case, both allow nulls and editable/not editable were respected:
Pro 2.6.2:

Online:
Below shows AnotherNoNullFld:

I would recommend creating a Support case to have an analyst take a closer look at the data and see if they can set up a repro case. It's possible that this was also something that was resolved in the FeatureSharingDraft class.
2) Publishing with the option to allow export:
I reproduced this using the FeatureSharingDraft class, then after some quick research realized it was logged as a bug: BUG-000117831: The export capability is not honored when using the ..
Let me know, and I can attach your account to this bug. It's marked as In Product Plan.
3) Time zones when overwriting web layer from Pro:
This issue was logged as an enhancement earlier this year, and it turns out specifying the time zone and daylight savings time is possible by using Python to edit the XML of the sddraft file. Someone on the Pro team (I think) wrote a code sample that was listed on the enhancement; I tested it and it works great. The sample is for FeatureSharingDraft but the XML editing part could probably be incorporated for use with CreateWebLayerSDDraft as it just edits the sddraft file. Script is below:
import arcpy
import os
import xml.dom.minidom as DOM
import codecs
import xml.etree.ElementTree as ET
def enable_extensions(sddraftPath, soe):
doc = DOM.parse(sddraftPath)
typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
if typeName.firstChild.data == soe:
extension = typeName.parentNode
for extElement in extension.childNodes:
if extElement.tagName == 'Enabled':
extElement.firstChild.data = 'true'
f = open(sddraftPath, 'w')
doc.writexml(f)
f.close()
def enable_configproperties(sddraftPath, soe, property_set):
doc = DOM.parse(sddraftPath)
typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
if typeName.firstChild.data == soe:
extension = typeName.parentNode
for extElement in extension.childNodes:
if extElement.tagName == 'Definition':
for definition in extElement.childNodes:
if definition.tagName == 'ConfigurationProperties':
for config_prop in definition.childNodes:
if config_prop.tagName == 'PropertyArray':
for prop in property_set:
prop_set = doc.createElement("PropertySetProperty")
attr = doc.createAttribute("xsi:type")
attr.value = "typens:PropertySetProperty"
prop_set.setAttributeNode(attr)
prop_key = doc.createElement("Key")
txt = doc.createTextNode(prop["key"])
prop_key.appendChild(txt)
prop_set.appendChild(prop_key)
prop_value = doc.createElement("Value")
attr = doc.createAttribute("xsi:type")
attr.value = "xs:string"
prop_value.setAttributeNode(attr)
txt = doc.createTextNode(prop["value"])
prop_value.appendChild(txt)
prop_set.appendChild(prop_value)
config_prop.appendChild(prop_set)
f = open(sddraftPath, 'w')
doc.writexml(f)
f.close()
if __name__ == "__main__":
username = "your_username"
pw = "your_password"
outdir = r"C:\...."
service = "ArcGIS Online Hosted Feature Service Name"
pro_project = r"C:\...\your_project_name.aprx"
arcpy.env.overwriteOutput = True
arcpy.SignInToPortal("https://arcgis.com", username, pw)
sddraft_filename = service + ".sddraft"
sddraft_output_filename = os.path.join(outdir, sddraft_filename)
aprx = arcpy.mp.ArcGISProject(pro_project)
m = aprx.listMaps()[0]
sddraft = m.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", service)
sddraft.summary = "My Summary"
sddraft.tags = "My Tags"
sddraft.description = "My Description"
sddraft.credits = "My Credits"
sddraft.useLimitations = "My Use Limitations"
sddraft.overwriteExistingService = True
sddraft.exportToSDDraft(sddraft_output_filename)
property_set = [{
"key": "dateFieldsRespectsDayLightSavingTime",
"value": "true"
},
{
"key": "dateFieldsTimezoneID",
"value": "Pacific Standard Time"
}]
enable_configproperties(sddraftPath=sddraft_output_filename, soe="FeatureServer", property_set=property_set)
enable_extensions(sddraftPath=sddraft_output_filename, soe="FeatureServer")
sd_filename = service + ".sd"
sd_output_filename = os.path.join(outdir, sd_filename)
arcpy.StageService_server(sddraft_output_filename, sd_output_filename)
print("Uploading Service Definition...")
arcpy.UploadServiceDefinition_server(sd_output_filename, "My Hosted Services")
I hope this helps,
-Peter
cc Nicole Corbin, Aaron Falk