Spatial Views and Relationships

689
2
08-21-2018 03:39 AM
CliveSwan
Occasional Contributor II

I am working in a Server for ArcGIS 10.3 environment with a Versioned Enterprise Oracle 12.g gdb.

We have a number of spatial tables/queries that are renewed every day. The Spatial tables are created joining several tables. We want to create spatial Views on the Default gdb.

If I export the required Spatial table/query to a Spatial table they lose the Joined data??

I want to use ArcPY/Python to export the Joined Spatial Table to a Spatial table (SpTable_JN), then create a relationship with a table (Data_JN). This should be a simple task, yet I keep getting an error that the tables cannot be Registered with the database.

Has anyone experienced a similar problem and found a solution?? I would appreciate any advice.

Kind regards,

Clive

0 Kudos
2 Replies
George_Thompson
Esri Frequent Contributor

Can you please post some of the Python that you are using to export the table and create the relationship? This will make troubleshooting easier. Also post a screenshot of the exact error message.

Thanks!

Enterprise GIS

--- George T.
0 Kudos
CliveSwan
Occasional Contributor II

Hi George,

Thanks for the reply. I am on holiday this week, don't have access to the code at work.

The code below is a rough copy of the logic used. The only error that I get from Create Relationship is:

"the feature is not Registered with the db"

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "D:/users/user"

## Copy Data

## Copy the Spatial View to Featyre
database = "TESTDB Connection.sde"

arcpy.CopyFeatures_management("TESTDB.SpTable_JNS_VW", "TESTDB.SpTable_JN_VW")

##Create Relationship
SptTbl = "TESTDB.SpTable_JN_VW"
SptData = "TESTDB.Data_JN"

# Create simple relationship class between SpTable_JN layer
# and Data_JN table with additional parcel owner information
SpTable = "SptTbl"
relClass = "TESTDB.EQUIP_RelClass"
forLabel = "SpTable.EQUIP_ID"
backLabel = "SptData.SW_ID"
primaryKey = "SpTable.EQUIP_ID"
foreignKey = "SptData.SW_ID"
arcpy.CreateRelationshipClass_management(SpTable,
SptData,
relClass,
"SIMPLE",
forLabel,
backLabel,
"BACKWARD",
"ONE_TO_MANY",
"NONE",
primaryKey,
foreignKey)

0 Kudos