I have created a simple python script to do the following:
Everything works up until step 4 which includes a DeleteRows function call and then an Append function call. I am using DeleteRows instead of truncate due to database locks. Currently this script works perfectly fine from my local machine, but on our server machine where this script will reside for scheduling purposes I run into the error 000732: dataset does not exist or is not supported. I have run through all of the suggested workarounds/solutions and none worked. I even ran the tool in catalog on the server machine and it worked, just not in the script.
Are there any additional suggestions or could this possibly be a bug?
Hi,
make sure that the variable path is set like this:
myvariable_path = r'C:\Temp\Integrations'
the letter "r" (raw path) is important.
Tomasz,
Thank you for your suggestion, but unfortunately all of my variables that contain string paths already have the "r" pre-fix so this suggestion does not apply.
The path isn't a Mapped drive on your local machine? Have you tried UNC or attempting to navigate to that path in Catalog/Windows Explorer on the server?
David,
No the error occurs when trying to use the Delete Rows function against the SDE database table/feature class. Currently when I run the Delete Rows function against the SDE database table/feature class from my local machine the function has no problem executing. The issue occurs when attempting to run the Delete Rows function against the SDE database table/feature class from our server machine (where the script will be run from once its fully tested). I'm 99% sure its not the file path name since I was able to navigate to the SDE table/feature class using the file path the script uses (both in windows file explorer and ArcCatalog on the server machine). I even ran the Delete Rows tool in ArcCatalog (using the SDE data) and it ran fine. I then took the code snippet from the results pane and inserted it into the script and it still failed.
if it's an SDE it's using a connection file I guess? Is that connection file being properly referenced and is the same as on the local machine?
Yes you are correct, it is using an SDE file. I assume it's referencing the connection file properly. I have the SDE connection file located in the same folder the script runs from and the script references the file as such:
db_test = r'C:\rn_development\COVID_Testing_Sites\AZURE_HealthDepartment_gisadministrator_93.sde\HealthDepartment.DBO.CovidTestSites\HealthDepartment.DBO.IDPH_COVID_Test_Sites'
arcpy.DeleteRows_management(db_test)
As for the file being the same on the local machine, yes to an extent. The exact paths differs, but the file was originally copied from local machine to the server when I was setting up the final testing on the server machine.
Perhaps the authentication in the connection file is OS_AUTH and the server doesn't have that privilege?
Checking the connection properties of each SDE connection file, each file is "Database Authentication", so I don't believe that is the issue.
I believe @DavidPike is likely correct, i.e., you are using OS authentication in the SDE file, and the service account running GIS Server doesn't have permissions to delete records.