Insert cursor: No support for this geometry type.

4320
14
12-09-2013 07:08 AM
SebastianBlesgen
New Contributor
Hi,

I try to do a [PHP]arcpy.InsertCursor("db.sde/db.dbo.IMPORT")[/PHP] but I have this exception:
[PHP]
ERROR 999999: Error executing function.\nNo support for this geometry type.')[/PHP]

[PHP]
    targetFeatures = arcpy.InsertCursor("db.sde/db.dbo.IMPORT")
  File "C:\Program Files\ArcGIS\Server\arcpy\arcpy\__init__.py", line 1214, in InsertCursor
    return gp.insertCursor(dataset, spatial_reference)
  File "C:\Program Files\ArcGIS\Server\arcpy\arcpy\geoprocessing\_base.py", line 369, in insertCursor
    self._gp.InsertCursor(*gp_fixargs(args, True)))
[/PHP]

My gdb is an SQL Server I created by myself then I use arcpy to create the used .sde and the IMPORT table. This table has a "Shape" field with polygon geometry type.

What this exception means? I'm using the 10.2 version and it worked with 10.0...
Tags (2)
0 Kudos
14 Replies
T__WayneWhitley
Frequent Contributor
Seriously?  ...pretty sure there is no pathname including arcpy/arcpy, right?! -- but I've been wrong before <chuckle> !


EDIT--
Ah, I am wrong, there is that pathname - but still, would you not instantiate an insertcursor like so:

arcpy.InsertCursor(....)

[not arcpy.arcpy...etc]
0 Kudos
SebastianBlesgen
New Contributor
Well, python was installed at Arcgis installation time.


  • C:\Python27\ArcGISx6410.2\Lib\site-packages contains the server10.2.pth file


    • C:\Program Files\ArcGIS\Server\bin

    • C:\Program Files\ArcGIS\Server\arcpy

    • C:\Program Files\ArcGIS\Server\ArcToolbox\Scripts

    • path_to_my_python_scripts

  • C:\Python27\ArcGIS10.2\Lib\site-packages contains desktop10.2.pth


    • C:\Program Files (x86)\ArcGIS\Desktop10.2\bin

    • C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy

    • C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Scripts



EDIT--
First post edited 😉
0 Kudos
TimBarnes
Occasional Contributor III
Any particular reason why you are mixing the older gp with the newer arcpy? Have you instantiated/imported them both?
0 Kudos
SebastianBlesgen
New Contributor
I installed Desktop and Server on the same machine 'cause I'm in dev. but both are at 10.2 version.
The goal was to use the existing code (dev. for 10.0). It doesn't work but I try to migrate..

Any idea? May be I can try to hide desktop10.2.pth from python classpath..
0 Kudos
T__WayneWhitley
Frequent Contributor
Could be different things and there's not enough information to diagnose, but I'll just take a shot at this - it almost sounds like you cannot connect to your table?  Is it registered with Server? - looks like you may be using the 64-bit Server install of Python if you installed that last, so you may just need to make sure you've installed the SQL Server native client (64-bit).

That's all I can think of at the moment -- I just thought of that because in my test installation, similar to yours, I have to upgrade the SDE in my 10.0 production environment before I can connect via my test environment (likely I will 'clone' my SQL Server instance to test the SDE upgrade).

Hope that helps,
Wayne
0 Kudos
SebastianBlesgen
New Contributor
Thanks to answer.

I'm still in dev with a completely new virtual machine (no 10.0 previous install).

I can access the DB (using SQL Server Management Studio) and if I drag N' Drop the .sde file I created in ArcCatalog 10.2 as a database connection, I see that it works and the "Shape" field (that have a "geometry" type) is well detected.

For now, I just test my python script as a unit test but same problem has occur when I tried to "share as -> geoprocessing service".

Note that before this problematic statement I successfully use a [PHP]arcpy.ArcSDESQLExecute("db.sde")[/PHP] to make insert in other table(s) that have no geometry field(s).

I think (but don't know why) it's a problem about the geometry fields 😕
0 Kudos
T__WayneWhitley
Frequent Contributor
I'm still trying to wrap my head around this - if you're able to execute arcpy.ArcSDESQLExecute then I think that eliminates an arcpy initialization error -- but it's probably initializing the Server py intall, i.e. the 64-bit version.  Not sure, but if you don't also have the 64 -bit sql native client installed, that may be triggering the error on your insert cursor.  So in Catalog, you're able to open the target table (with the geometry) okay?  No errors?  What errors are displayed in the log (sdedc_SQL_Server.log file in the %TEMP% directory).

Does this help, or am I barking up the wrong tree? :

"If you are installing the SQL Server native client on a 64-bit operating system, use the 64-bit SQL Server native client executable. This executable installs both the 32- and 64-bit client, which allows it to work with both 32- and 64-bit applications. If you run the 32-bit SQL Server native client on a 64-bit operating system, it will fail."
[from:  Setting up a connection to SQL Server
Geodata » Administering geodatabases » Geodatabases in SQL Server
http://resources.arcgis.com/en/help/main/10.2/index.html#//002q00000038000000]
0 Kudos
T__WayneWhitley
Frequent Contributor
Oh, I think I *may* see what's going on...are you trying to set up your connection to feature classes via ArcSDESQLExecute?

I don't think it is designed for that - it's true you can run SQL statements using the connection, but it's geared I think to run on the indiviual SQL tables --- inserting on gdb tables for fcs in this way may lead to data corruption.

So I think what you're really trying to do here is set the env workspace variable to your working spatial connection, then establish the cursor...I don't see the rest of your code, so still not sure what you're doing.  Basically, this link shows in simple terms how you'd open an fc with a cursor (although I'd probably use a UNC pathname to an accessible location rather than the 'Database Connections' shortcut):

http://forums.arcgis.com/threads/90868-insertRow-into-SQL-server

Interesting -- please let me know if you've found a solution.  With ArcSDESQLExecute you may have shown me a way to update ordinary tables faster.
0 Kudos
SebastianBlesgen
New Contributor

  • To be sure, I re-installed the client (x64) and it didn't help.

  • I have no sdedc_SQL_Server.log file Oo?

  • My %TEMP% is %USERPROFILE%\AppData\Local\Temp which is not an existing directory on my file system

  • I'm not trying to use arcpy.ArcSDESQLExecute for this IMPORT table

  • I write a simple example that doesn't work to show you what i'm trying to do



[PHP]
import os
import arcpy
from arcpy import env

# base path
base = r"C:/lpd/Python Scripts"

# Database connection string (arcpy.ArcSDESQLExecute)
dbName = r"db"
db = r'DRIVER={SQL Server};SERVER=DGENV-LPD2.aris-lux.lan\LPD;DATABASE=' + dbName + r';UID=user;PWD=pass'

# Target coordinate system
targetCoordinateSystem = arcpy.SpatialReference("Projected Coordinate Systems/World/WGS 1984 Web Mercator (auxiliary sphere)")

# Path of the ArcSDE connection file (.sde).
targetGeoDatabase = os.path.normpath(os.path.join(base, "connections/" + dbName + r".sde"))

# Shapefile rows are imported to the "targetFeatureClass" feature class
targetFeatureClass = os.path.normpath(os.path.join(targetGeoDatabase, dbName + ".dbo.IMPORT" ))

# Workspace
env.workspace = targetGeoDatabase

targetFeatures = arcpy.InsertCursor(targetFeatureClass)
       [...]
[/PHP]

Actually, I'm surprise that the database is not embellished with some table/data by arcsde to manage the "geo" extension stuffs. Is that normal? I thought that the SDE or DBO schema will have these additional tables...
0 Kudos