Hello,
I'm looking for something like arcpy.management.is_registered(db, tbl) to determine whether a table is registered with a selected Enterprise Geodabase.
For reference here is the method for registering a table...
arcpy.management.RegisterWithGeodatabase(<>)
Tyler
ArcGIS Pro 3.2
Solved! Go to Solution.
maybe something like this?
import arcpy
# Path to your table within the geodatabase
table_path = r"C:\Path\To\Your\Database.sde\TableName"
# Check if the table exists
if arcpy.Exists(table_path):
# Get the workspace (geodatabase connection)
workspace = arcpy.Describe(table_path).path
# Check if the workspace is an Enterprise Geodatabase
if arcpy.Describe(workspace).workspaceFactoryProgID == "esriDataSourcesGDB.SDEWorkspaceFactory.1":
# List registered tables in the geodatabase
registered_tables = arcpy.ListTables("*", "", workspace)
# Check if the table is in the list of registered tables
if table_path in [t.dataSource for t in registered_tables]:
print("The table is registered with the Enterprise Geodatabase.")
else:
print("The table is not registered with the Enterprise Geodatabase.")
else:
print("The workspace is not an Enterprise Geodatabase.")
else:
print("Table does not exist.")
maybe something like this?
import arcpy
# Path to your table within the geodatabase
table_path = r"C:\Path\To\Your\Database.sde\TableName"
# Check if the table exists
if arcpy.Exists(table_path):
# Get the workspace (geodatabase connection)
workspace = arcpy.Describe(table_path).path
# Check if the workspace is an Enterprise Geodatabase
if arcpy.Describe(workspace).workspaceFactoryProgID == "esriDataSourcesGDB.SDEWorkspaceFactory.1":
# List registered tables in the geodatabase
registered_tables = arcpy.ListTables("*", "", workspace)
# Check if the table is in the list of registered tables
if table_path in [t.dataSource for t in registered_tables]:
print("The table is registered with the Enterprise Geodatabase.")
else:
print("The table is not registered with the Enterprise Geodatabase.")
else:
print("The workspace is not an Enterprise Geodatabase.")
else:
print("Table does not exist.")