I got this sql table im working with, it has a geometry column but contains multiple geometry types,
[u'POLYGON', u'LINESTRING', u'GEOMETRYCOLLECTION', u'POINT', u'MULTILINESTRING', u'MULTIPOLYGON']
Im using arcpy's arcsdesqlexecute and I seem to be hitting an error loading the column as is, I tried converting it to varchar but I don't feel its necessary.
Any thoughts guys?
Sorry for the lack of detail earlier,
Here is the traceback report,
Traceback (most recent call last):
File "Path\ExtractDataToCSV.py", line 37, in <module>
extract = in_connection.execute(sql)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\arcobjects.py", line 27, in execute
AttributeError: ArcSDESQLExecute: SreamBindOutputColumn ArcSDE Error -65 \uda10
So this happens when I include the geometry column that has multiple geometry types. Without it, the table loads fine. I can load the geometry type but I have to do something like this,
"cast(GeoLocation as varchar(8000)) as GeoLocation"
This will load it as string but still I have to work a process to convert them as geometries. Wondering if there is a simpler or better way of reading sql tables like this.
Ever since ArcSDE faded away as a standalone product and got integrated into ArcGIS for Server, at least from a marketing and licensing perspective, I have found some of the worthwhile documentation from earlier releases doesn't move forward. I believe the ArcSDE 10.0 C API Return codes are still mostly accurate for ArcGIS 10.2.x and ArcGIS 10.3.x:
Returned by functions that are passed pointers to data that are either NULL or invalid.
If you are trying to export geographic data as geographic data from an enterprise geodatabase, ArcSDESQLExecute is the wrong tool. The tool doesn't work with native spatial data types returned from various DBMSes.
Correct. ArcSDESQLExecute is written using the 'old' SDE libraries which requires the spatial table to be registered with SDE (Enterprise GDB) and for the shape field to only contain one geometry type. From what I can tell from the info provided, Query Layers are probably the way to go.
Thanks heaps for all the feedback guys. Since I don't want to create query layers in an mxd, I could just probably use arcpy.MakeQueryLayer_management and do something with the records while in_memory I guess. But I just want to validate if "GeometryCollection" type can be recognized? In my case this type is just composed of multiple polygon so pretty much like a "MultiPolygon".
Unfortunately, Esri does not supported the GeometryCollection type yet:
ArcGIS does not support the following geometry subtypes:
I would like to see if the Data Interoperability extension can solve your problem.
It doesn't care about mixed geometry types.
If you can get your data to us we'll take a look.