RegisterWithGeodatabase() takes at most 1 argument

1307
5
Jump to solution
08-04-2017 01:02 AM
SamNeefs
New Contributor

I want to register a view to the Geodatabase. 

Since it's a view, I have to pass trough the second parameter with the ObjectID-column.

However, if I passtrough more than one paremeter, I get the error "RegisterWithGeodatabase() takes at most 1 argument".

I followed the example from Register with Geodatabase—Data Management toolbox | ArcGIS Desktop:

# RegisterWithGeodatabase.py
# Description: Simple example showing use of RegisterWithGeodatabase tool

# Import system modules
import arcpy

# Set variables
inTable = r"F:\DatabaseConnections\ANB-SQL-001_ANBGISv10_ISANBGIS.sde\V_BEHEEREENHEDEN_IVANHO_TEST1"
oid_field = "OBJECTID"
shape_field = "Shape"
geometry_type = "POLYGON"
sr = arcpy.SpatialReference(31370)
in_extent = "17736.0314 23697.0977 297289.9391 245375.4223"

# Process: Register With Geodatabase
arcpy.RegisterWithGeodatabase_management(inTable, oid_field, shape_field, geometry_type, sr, in_extent)

#Process: Use the CreateArcSDEConnectionFile function
#arcpy.RegisterWithGeodatabase_management (inTable, oid_field, shape_field)

This is the complete error:

Traceback (most recent call last):
File "C:\register.py", line 16, in <module>
arcpy.RegisterWithGeodatabase_management(inTable, oid_field, shape_field, geometry_type, sr, in_extent)
TypeError: RegisterWithGeodatabase() takes at most 1 argument (6 given)

0 Kudos
1 Solution

Accepted Solutions
VinceAngelo
Esri Esteemed Contributor

You can't register a view with a geodatabase with 10.3.1 Desktop.  If you go to the appropriate documentation, you'll see the list of objects which can be registered is different ("feature classes, tables, and raster layers" vice "feature classes, tables, views, and raster layers"). The ability to register views is new at 10.5.x.

- V

View solution in original post

5 Replies
SamNeefs
New Contributor

(P.S. I'm using Arcgis 10.3.1)

0 Kudos
LukeWebb
Occasional Contributor III

The message / stacktrace seems like a bug to me! (Or just a bad error message).

Is your "InTable" correct...

inTable = r"F:\DatabaseConnections\ANB-SQL-001_ANBGISv10_ISANBGIS.sde\V_BEHEEREENHEDEN_IVANHO_TEST1"

All mine are like this: (Like in the example)

inTable = r"F:\DatabaseConnections\ANB-SQL-001_ANBGISv10_ISANBGIS.sde\DATABASE.DataOwner.V_BEHEEREENHEDEN_IVANHO_TEST1"

To test, use the "Add data" button in ArcMap, and see if your path can be pasted in directly to add the table.

0 Kudos
VinceAngelo
Esri Esteemed Contributor

You can't register a view with a geodatabase with 10.3.1 Desktop.  If you go to the appropriate documentation, you'll see the list of objects which can be registered is different ("feature classes, tables, and raster layers" vice "feature classes, tables, views, and raster layers"). The ability to register views is new at 10.5.x.

- V

SamNeefs
New Contributor

Thanks, I didn't see this, since the page I referenced didn't mention a version, I expected it to be for all versions.

Your link clearly is the version I use and it indeed doesn't support views and doesn't accept more than one parameter.

0 Kudos
VinceAngelo
Esri Esteemed Contributor

It can be a pain, because the Pro documentation is often found first in searches, but it's important to use the documentation for the software you are actually using. I generally go to desktop.arcgis.com, then Search, and specify the ArcMap flavor (vice "any"). Pro is sufficiently different that you shouldn't ever rely on its Python docs while using 32-bit Desktop or 64-bit Background Geoprocessing (it's even a different Python).

- V