copy feature dataset to feature dataset

3482
11
12-09-2016 02:24 PM
JaredPilbeam1
Occasional Contributor

Every script I've tried isn't able to copy the feature dataset in the top image to the bottom feature dataset (in an SDE).

It's probably something simple, but is there a known function for this? I can't change anything in the SDE as I don't have administrative rights to it. 

I've tried Copy_management. But, here the in_data and out_data variables must have the same file extension to work properly.

I've also tried CopyFeatures_management. Here's the syntax and error message for that:

# Import modules
import os
import arcpy

# set workspace
env.workspace = r"T:\Departments\E911\Transfer Files\E911WeeklyUpdate\E911WeeklyUpdate.gdb"

#create a list of feature classes in the current workspace
fclist = arcpy.ListFeatureClasses()

#copy each feature class to a fgdb 
for fc in fclist:
    fcdesc = arcpy.Describe(fc)
    arcpy.CopyFeatures_management(fc, os.path.join("Database Connections\
    Jared to plainfield.sde\gisedit.DBO.MGU_Will", fcdesc.basename))

0 Kudos
11 Replies
DarrenWiens2
MVP Honored Contributor

Try 'print fclist'. It looks like there's nothing there.

Also, there's something fishy going on. You should get an error at 'env.workspace' since you haven't imported env.

0 Kudos
JaredPilbeam1
Occasional Contributor

Thanks Darren. 

I scrapped that script any tried arcpy.Copy_management. Basically, I'm trying to replace a feature dataset within an sde (here: plainfield.sde) with a dataset from a local gdb, as the features change weekly. The rewritten script below gets an error in the part of the script that attempts to copy from the local gdb (E911WeeklyUpdate.gdb\MGU_Will) to the plainfield.sde. Can you write to an sde? I haven't read anywhere that you can't. 

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

You may want to look at 2-way replication, if you haven't already.

Replication types—ArcGIS Help | ArcGIS for Desktop 

0 Kudos
JaredPilbeam1
Occasional Contributor

Sorry, my pseudocode is misleading. Let me clarify a bit more.

I’m trying to copy a dataset from a local gdb to an sde. This dataset already exists in the sde—I just need to update it with the dataset from the local gdb. There’s a schema lock error. I don’t have the database open and the ‘Jared to plainfield.sde’ version used in this script is a copy of the main sde called ‘ims to Plainfield’. But, I’m not the administrator and surely there are other GIS people in the building using the sde. I’m only using the ‘Jared’ version to practice run this script, then I want to use it on the ‘ims to Plainfield.sde’.

0 Kudos
Asrujit_SenGupta
MVP Regular Contributor

Versions in an Enterprise Geodatabase refers to a completely different concept.

I assume what you are referring to is the Connection File name (the images attached are too small to see clearly) pointing to a Test env for now, before using it against the Production\main Enterprise gdb.

RebeccaStrauch__GISP
MVP Emeritus

But, I’m not the administrator and surely there are other GIS people in the building using the sde.

If you are not the administrator for the sde database, do you know if you have write permissions?

re: locks

Manage geodatabase locks—Help | ArcGIS for Desktop    but again, if you are not the administrator, you may not be able to do much with it.

JaredPilbeam1
Occasional Contributor

I have no control over the locks, apparently. After right clicking the feature class within the feature dataset, 'locks' is grayed out. 

Here are the above images made larger:

0 Kudos
Asrujit_SenGupta
MVP Regular Contributor

These Datasets are owned by DBO, which is a Admin login. You cannot delete these datasets, connected as any other login, other than the Admin (any login which has been granted 'sysadmin' role).

So you must look into this aspect first.

JaredPilbeam1
Occasional Contributor

Thanks Asrujit,

So, generally speaking, you can't write to an SDE without administrative rights?

0 Kudos