Composing a map using query layers in ArcGIS 10.4.1 (Basic) the final step is to backup the data used when the map is finalised.
Exporting manually is straight forward.
But using the conversion tool results in ERROR 999999.
Using arcpy as elaborated in https://geonet.esri.com/thread/66389#comment-303614 produces on the help and syntax window in short:
ERROR 000210: (...) No support for this geometry type. Error executing FeatureClassToFeatureClass (...).
(in original:
Ausführung von: FeatureClassToFeatureClass GPL0 D:\test "name of the layer".shp # "CITY "CITY" true true false 100 Text 0 0 ,First,#,GPL0,CITY,-1,-1" #
Startzeit: Tue Jan 17 07:25:20 2017
ERROR 000210: Ausgabe D:\test\"name of the layer".shp kann nicht erstellt werden.
No support for this geometry type.
Fehler beim Ausführen von (FeatureClassToFeatureClass).
Fehlgeschlagen am Tue Jan 17 07:25:20 2017 (Verstrichene Zeit: 0,02 Sekunden)
)
the primary prompt shows:
Runtime error Traceback (most recent call last): File "", line 5, in File "c:\software\arcgis\desktop10.4\arcpy\arcpy\conversion.py", line 1694, in FeatureClassToFeatureClass raise e ExecuteError: ERROR 000210: Ausgabe D:\test\"name of the layer".shp kann nicht erstellt werden. Fehler beim Ausführen von (FeatureClassToFeatureClass).
import arcpy
mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd, "Layer")[0]
count = 0
for lyr in arcpy.mapping.ListLayers(mxd, "", df):
if count < 20:
count +=1
name = lyr.name
arcpy.FeatureClassToFeatureClass_conversion(lyr, r"D:\test", name + ".shp")
Querying for the geometry type via: select distinct a.geom.SDO_GTYPE from "name of the original table" a results in: 2001 (The 2 indicates two-dimensional, and the 1 indicates a single point.)
A successful export not explicitly for query layers is also discussed here. Checking the layer properties source within ArcMap reveals the Data Type of Query Feature Class.
How would one be able to export then this type using arcpy?