AnsweredAssumed Answered

Reference non-SDE sql table in python script - arcpy.Append_management

Question asked by ascullyCOT on Feb 21, 2018
Latest reply on Feb 22, 2018 by ascullyCOT

I'm wondering if anyone can help with the syntax (or confirm that it can be done) to reference an SQL table that's in a non-spatial database in a python script

In my case I'm trying to append from this table into an SDE table.  I need the field mapping, because there is an ID field in the source table (non-spatial) that needs to be preserved and by default it treats it as an object id field, so it changes every time the job is run, which is a problem.  So it is mapped to the correct column in the target (SDE) table.  


The connection to the SQL non-spatial database is fine in ArcMap, and I can run the append tool without issue.  Whne I grab the python snippet, no matter how I modify the table name/path, the Append_management section fails, saying 'Cannot open table...' (the input table).


Here's what I have:  (only import currently is arcpy)


(inputs="SQLDB.TABLENAME.dbo.users",   *this is what the table is listed as under 'properties' in the catalog window in ArcMap





SDE_DEV is a variable that is the path to the SDE connection file + sde file name to our dev sde database.  I've tried the same methodology for the input dataset, with no luck so far.


Gracias -