Export features from Parcel Fabric using Python

2112
10
10-11-2021 06:08 PM
Bryn_Dunbar
New Contributor II

We have a new Fabric built, at my organization, and I am reaching out to see if anyone has had success exporting the feature classes inside of the Fabric dataset to another geodatabase, using Python. I have created a simple Python script using the FeatureClassToFeatureClass_conversion ArcPy function. This script works as it is designed for features classes in file geodatabases. It also works on feature classes in Enterprise geodatabases. However, when I tried to run my script, to export feature classes from the Fabric dataset, in an Enterprise geodatabase, I get an error:

LandRecordsMapping.ENTERPRISE.PARCEL_LOT_POLYGONS does not exist or is not supported

This feature class does exist inside the Fabric Dataset. Here is a picture of the feature class that exists in the Fabric dataset:

Bryn_Dunbar_4-1634000208792.png

This script error makes me think that the feature class from the Fabric dataset is not supported for this script. I did some research and found something that said feature classes in a feature dataset, with attribute rules, are not readable with arcpy. I’m not sure if this is true, but the “not supported” part of the script error leads me to believe that ArcPy is not detecting my feature class because it isn’t readable from ArcPy.

How can I run the FeatureClassToFeatureClass function, from my Parcel Fabric dataset, using ArcPy? If it can’t be done using ArcPy, how else can I export feature classes from a fabric dataset (with attribute rules) to another geodatabase, as a non-fabric feature class.

My python script is attached and looks like this:

Bryn_Dunbar_0-1634084127166.png

Note: I have successfully run the Feature Class to Feature Class tool in a model in ModelBuilder, in ArcPro, to export a feature class in the Fabric dataset to another geodatabase. This works as I expect it to, but I was hoping I could do this task in a simple python script instead.

Thank you for any advice.

 

 

 

0 Kudos
10 Replies
Paul_Christensen
Occasional Contributor

I have not worked with sde at all, however, in a regular FGDB I use arcpy with feature classes that have attribute rules all the time. 

I would try adding an 'r' to the beginning of your file paths, like you did for the workspace, to be sure that the file path is read correctly.

Spaces and escape sequences (\n, \b, \f, etc) can confuse file paths.

"C:\My Documents"

r"C:\My Documents"

 

0 Kudos
Bryn_Dunbar
New Contributor II

Thank you for the suggestions Paul. I added the 'r' to the beginning of my file paths, but the python script still comes up with the same error. I appreciate your response.

0 Kudos
KenGalliher1
Esri Contributor

It looks to me like you're setting the environment workspace to a file geodatabase while working between two enterprise geodatabases.  That shouldn't be a problem but, try commenting out that line or set the env.workspace to your inFeatures SDE connection file. 

arcpy.env.workspace = <inFeatures_connection_file.sde>

 

Also, do you get the same error running the Feature Class to Feature Class geoprocessing tool from Pro?

 

Ken

0 Kudos
Bryn_Dunbar
New Contributor II

Thank you for the advice Ken.

I tried my script after removing the workspace line of code and it still came up with the same error. I tested my script by replacing the input with a feature class outside of the fabric dataset and the script ran without error. However, once I make the input for my Feature Class to Feature Class function, a feature class inside of the fabric dataset, I get the same error about my feature class not existing or not being supported. I have verified that it exists. 

I did run the Feature Class to Feature Class Tool in ArcPro using the feature class (PARCEL_LOT_POLYGONS) inside of the Fabric dataset and it ran without fail or error. I think its great that it works in ArcGIS Pro, but why doesn't it work in my python script?

Bryn_Dunbar_0-1634147462667.png

 

KenGalliher1
Esri Contributor

Hi Bryn,

Update:  False alarm.  My error came from a different issue.  However, staying with the path theme, can you confirm that the same path used the GP tool or model builder is the same path in the script? 

I was able to reproduce the error by putting my .sde connection file in a path with a very long character length.

 

 

I know there are technically limitations on path character lengths in Windows, Python and ArcPy but I'm not sure which one(s) is occurring here since it works from the GP tool and Model Builder.  My path above is 252 characters long so I don't think my issue is Windows.

https://desktop.arcgis.com/en/system-requirements/10.5/os-limits-windows.htm

 

Please try to shorten the inFeatures path length and see if that helps.  I'll see if I can find more info.

0 Kudos
Bryn_Dunbar
New Contributor II

Thanks for the idea about the file path name being too long. However, I edited my python script, with a reduced file path length, by renaming my ArcGIS Pro project database connections, and created a new ArcGIS Pro project. I am still getting an error.  I even copied and pasted the file path of the input feature for the Feature Class to Feature Class tool directly from the ArcPro Model (ModelBuilder) into my python script. The ArcPro Model works perfectly. However, my python script still comes up with an error: 

Bryn_Dunbar_0-1634860144449.png

 

0 Kudos
KenGalliher1
Esri Contributor

Interesting.  If you can, please log a case with Support.  This shouldn't be happening.

0 Kudos
Bryn_Dunbar
New Contributor II

Thank you for the advice Ken. I will do that.

Paul_Christensen
Occasional Contributor

What happens if you export the model to the python window (or file) and run the model as a python script?

 

Paul_Christensen_0-1634908660705.png

 

0 Kudos