Register with Geodatabase (Data Management)

Summary

Registers with the geodatabase the feature classes, tables, views, and raster layers that were created in the database using third-party tools or views created with the Create Database View tool. Once registered, information about the items—such as table and column names, spatial extent, and geometry type—is stored in the geodatabase's system tables, allowing these registered items to participate in geodatabase functionality.

Usage

  • Use this tool to register with the geodatabase the feature classes, tables, views, and raster layers you create in the database with third-party tools or SQL.

  • Views you create in file and enterprise geodatabases using the Create Database View tool can be registered with the geodatabase.

  • To register with an enterprise geodatabase, you must be connected as the owner of the input dataset.

  • Before a feature class, table, or raster layer can fully participate in geodatabase functionality, it must be registered with the geodatabase. If it is not registered with the geodatabase, only limited functionality is available from ArcGIS clients and services.

  • Views that are registered with the geodatabase cannot participate in some geodatabase behavior and are read-only via ArcGIS clients. Views are not supported in feature services even if you register them with the geodatabase.

Parameters

LabelExplanationData Type
Input Datasets

The feature class, table, view, or raster created using third-party tools or SQL, or the view created using the Create Database View tool that will be registered with the geodatabase. The dataset must exist in the same database as the geodatabase.

Table View; Raster Layer
Object ID Field
(Optional)

The field that will be used as the ObjectID field. This input is required when registering a view, and you must supply an existing integer field. This parameter is optional when registering other dataset types; if you use an existing field, it must be an integer data type. If an existing field is not supplied when registering these other dataset types, an ObjectID field will be created and populated.

Field
Shape Field
(Optional)

If the input dataset contains a spatial data type column, include this field during the registration process.

Field
Geometry Type
(Optional)

Specifies the geometry type. If the Shape Field parameter value is present, you must specify a geometry type. Supported geometry types are point, multipoint, polygon, and polyline. If the dataset being registered contains existing features, the geometry type specified must match the entity type of these features.

  • PointThe geometry type is point.
  • MultipointThe geometry type is multipoint.
  • PolygonThe geometry type is polygon.
  • PolylineThe geometry type is polyline.
String
Coordinate System
(Optional)

If the Shape Field parameter value is present and the table is empty, specify the coordinate system to be used for features. If the dataset being registered contains existing features, the coordinate system specified must match the coordinate system of the existing features.

Spatial Reference
Extent
(Optional)

If the Shape Field parameter value is present, specify the allowable coordinate range for x,y coordinates. If the dataset being registered contains existing features, the extent of the existing features will be used.

Envelope

Derived Output

LabelExplanationData Type
Registered Dataset

The registered dataset.

Table

arcpy.management.RegisterWithGeodatabase(in_dataset, {in_object_id_field}, {in_shape_field}, {in_geometry_type}, {in_spatial_reference}, {in_extent})
NameExplanationData Type
in_dataset

The feature class, table, view, or raster created using third-party tools or SQL, or the view created using the Create Database View tool that will be registered with the geodatabase. The dataset must exist in the same database as the geodatabase.

Table View; Raster Layer
in_object_id_field
(Optional)

The field that will be used as the ObjectID field. This input is required when registering a view, and you must supply an existing integer field. This parameter is optional when registering other dataset types; if you use an existing field, it must be an integer data type. If an existing field is not supplied when registering these other dataset types, an ObjectID field will be created and populated.

Field
in_shape_field
(Optional)

If the input dataset contains a spatial data type column, include this field during the registration process.

Field
in_geometry_type
(Optional)

Specifies the geometry type. If the in_shape_field parameter value is present, you must specify a geometry type. If the dataset being registered contains existing features, the geometry type specified must match the entity type of these features.

  • POINTThe geometry type is point.
  • MULTIPOINTThe geometry type is multipoint.
  • POLYGONThe geometry type is polygon.
  • POLYLINEThe geometry type is polyline.
String
in_spatial_reference
(Optional)

If the in_shape_field parameter value is present and the table is empty, specify the coordinate system to be used for features. If the dataset being registered contains existing features, the coordinate system specified must match the coordinate system of the existing features. Valid values are a Spatial Reference object, a file with a .prj extension, or a string representation of a coordinate system.

Spatial Reference
in_extent
(Optional)

If the in_shape_field parameter value is present, specify the allowable coordinate range for x,y coordinates in the following order: "XMin YMin XMax YMax". If the dataset being registered contains existing features, the extent of the existing features will be used.

Envelope

Derived Output

NameExplanationData Type
reg_dataset

The registered dataset.

Table

Code sample

RegisterWithGeodatabase example 1 (Python window)

The following Python window script demonstrates how to use the RegisterWithGeodatabase function in the Python window for a spatial table that contains point geometry features. Since the underlying table contains existing features, the coordinate reference and feature extent information can be discovered and do not need to be explicitly listed.

import arcpy
arcpy.env.workspace = r"Database Connections/connection.sde"
arcpy.RegisterWithGeodatabase_management("database.owner.COUNTIES", "OID", 
                                         "Shape", "POINT")
RegisterWithGeodatabase example 2 (stand-alone script)

The following stand-alone script is a simple example of how to apply the RegisterWithGeodatabase function in scripting.

# RegisterWithGeodatabase.py
# Description: Simple example showing use of RegisterWithGeodatabase tool
 
# Import system modules
import arcpy

# Set variables
inTable = r"c:\connectionFiles\Connection to esriServer.sde\database.dbo.cities"
oid_field = "OID"
shape_field = "Shape"
geometry_type = "POINT"
sr = arcpy.SpatialReference(4326)
in_extent = "11 10 14 34"

# Process: Register With Geodatabase
arcpy.RegisterWithGeodatabase_management(inTable, oid_field, shape_field, 
                                         geometry_type, sr, in_extent)
RegisterWithGeodatabase example 3 (stand-alone script)

Register a view named trees in a file geodatabase.

# RegisterWithGeodatabase.py
# Description: Example showing use of RegisterWithGeodatabase tool with a file 
#              gdb view.

# Import system modules
import arcpy

# Create a view in the geodatabase
arcpy.CreateDatabaseView_management("C:\\testdata\\mytest.gdb",
                                    "trees",
                                    "select objectid, owner, parcel from inventory where type = trees")

# Set variables
inTable = r"C:\\testdata\\mytest.gdb\\trees"

# Process: Register With Geodatabase
arcpy.RegisterWithGeodatabase_management(inTable, "objectid")

Environments

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics