I have an SQL Server view that at I want to include in my ArcGIS server's REST endpoint as a table. I'm able to do it manually using ArcMap - it appears to create a query table when I drag the view onto the table of contents. How can I do this in python?
Currently I go through this sequence
It appears to generate a good mxd file - I can go into ArcMap and everything looks correct, but when I try to stage it for publishing I get this error:
ExecuteError: ERROR 001272: Analyzer errors were encountered (codes = 33, 33)
Standalone table's data source is not supported
I suspect that my step 4 is wrong - once I have the query table I need to do something else to get it into the map correctly but I'm not sure what that is.
Solved! Go to Solution.
I got it working with Python 3 here are the steps.
This sequence is actually the same as the code I use to add regular tables (not views) to a map - so it should have been fairly obvious to me. I think the real reason my code kept failing was that my view did not include an OBJECTID column - or perhaps more precisely a column with non-null unique values (at least that is what the documentation says is required of all tables and views). Once I added a non-null unique column column I was able to create and publish the map.
I got this to work on Python 2.7 by changing step 3 from MakeQueryTable to MakeQueryLayer. Now I'm trying to figure out how to do the equivalent in Python 3/ArcPro.
I got it working with Python 3 here are the steps.
This sequence is actually the same as the code I use to add regular tables (not views) to a map - so it should have been fairly obvious to me. I think the real reason my code kept failing was that my view did not include an OBJECTID column - or perhaps more precisely a column with non-null unique values (at least that is what the documentation says is required of all tables and views). Once I added a non-null unique column column I was able to create and publish the map.