Workspace already in transaction mode Planned maintenance scheduled April 17/18, 2019 at...
What font is "z" in "z-score"?
Is there any way for the UK Prime Minister to make a motion directly dependent on Government confidence?
Is it cost-effective to upgrade an old-ish Giant Escape R3 commuter bike with entry-level branded parts (wheels, drivetrain)?
How would a mousetrap for use in space work?
Is it common practice to audition new musicians one-on-one before rehearsing with the entire band?
Compare a given version number in the form major.minor.build.patch and see if one is less than the other
Do I really need recursive chmod to restrict access to a folder?
Do square wave exist?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Amount of permutations on an NxNxN Rubik's Cube
Is there a kind of relay only consumes power when switching?
Can a party unilaterally change candidates in preparation for a General election?
What is the longest distance a player character can jump in one leap?
How to answer "Have you ever been terminated?"
Can an alien society believe that their star system is the universe?
What do you call the main part of a joke?
Does classifying an integer as a discrete log require it be part of a multiplicative group?
How to deal with a team lead who never gives me credit?
Is safe to use va_start macro with this as parameter?
Wu formula for manifolds with boundary
What does "lightly crushed" mean for cardamon pods?
Most bit efficient text communication method?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
Workspace already in transaction mode
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Debugging RuntimeError: workspace already in transaction mode from arcpy.da.UpdateCursor and ArcSDE feature classes?Python workspaceResolving invalid workspace errorArcpy - deleted my entire workspace?Debugging RuntimeError: workspace already in transaction mode from arcpy.da.UpdateCursor and ArcSDE feature classes?Toggling draft mode using ArcPy?Using multiple workspace environments ArcGIS PythonCompleting transaction in ArcPy?Changing workspace leads to 'NoneType' errorSkipping 'file already exists' error in ArcPy?ListDatasets() returning empty array on sde workspace
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am writing a script to use an updatecursor. The feature class is locked so I am versioning the database, creating a feature layer, and reconciling versions. I have taken the skeleton for my script from this thread. Debugging RuntimeError: workspace already in transaction mode from arcpy.da.UpdateCursor and ArcSDE feature classes?
The main difference is that I already had an SDE connection file in my directory. Should this be re-created each time the script is executed to avoid this error?
__author__ = 'Administrator'
from arcpy import *
import GetSRConfig
import os
import time
def GetDateTimeString(n = None):
""" format a datetime to string """
if(n==None):
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
else:
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
if((isNumeric(n)==True) and ((n>4) and (n<14))):
s = s[0:n]
else:
s = s[0:14]
return s
def isNumeric(s):
b = True
try:
i = float(s)
except: # not numericelse: # numeric
b= False
return b
#Locals
P6featureName = GetSRConfig.SDELayer
Parent = "dbo.DEFAULT"
version = "myVersion" + GetDateTimeString(12)
featureLyr = "lyr" + GetDateTimeString(12)
print version
# Server = ***
# Service = ***
user ="dbo"
# Pass = ***
# SDE = 'E:C_Drive_filesAdministrator'311RequestdataServiceRequest.sde'
temploc = ""
fil = "SDETempConn"
env.overwriteOutput = True
#Create Version
print "Creating version"
arcpy.CreateVersion_management (GetSRConfig.SDEConnFile, Parent, version, "PUBLIC")
VersionName = user.upper() + "." + version
#Create new connection
workspace = os.path.join (temploc, fil + ".sde")
print workspace
#Layers
P6feature = os.path.join (workspace, P6featureName)
arcpy.MakeFeatureLayer_management (GetSRConfig.SDELayer, featureLyr)
#Start editing
print "Initiating editing"
edit = arcpy.da.Editor (GetSRConfig.SDEConnFile)
edit.startEditing ()
edit.startOperation()
#Test Cursor
print "Testing cursor"
P6Cursor = arcpy.da.UpdateCursor (featureLyr, ["VehicleNam"])
for row in P6Cursor:
print row[0]
del row
del P6Cursor
#Stop/save edits
edit.stopOperation()
print "Stopping editing"
edit.stopEditing("True")
#Switch to version
print "Switching version"
arcpy.ChangeVersion_management(featureLyr, "TRANSACTIONAL", Parent)
#Reconcile and post
print "Reconciling and posting"
arcpy.ReconcileVersions_management (GetSRConfig.SDEConnFile, "", Parent, VersionName, with_post = "POST", with_delete = "DELETE_VERSION")
arcpy cursor
|
show 2 more comments
I am writing a script to use an updatecursor. The feature class is locked so I am versioning the database, creating a feature layer, and reconciling versions. I have taken the skeleton for my script from this thread. Debugging RuntimeError: workspace already in transaction mode from arcpy.da.UpdateCursor and ArcSDE feature classes?
The main difference is that I already had an SDE connection file in my directory. Should this be re-created each time the script is executed to avoid this error?
__author__ = 'Administrator'
from arcpy import *
import GetSRConfig
import os
import time
def GetDateTimeString(n = None):
""" format a datetime to string """
if(n==None):
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
else:
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
if((isNumeric(n)==True) and ((n>4) and (n<14))):
s = s[0:n]
else:
s = s[0:14]
return s
def isNumeric(s):
b = True
try:
i = float(s)
except: # not numericelse: # numeric
b= False
return b
#Locals
P6featureName = GetSRConfig.SDELayer
Parent = "dbo.DEFAULT"
version = "myVersion" + GetDateTimeString(12)
featureLyr = "lyr" + GetDateTimeString(12)
print version
# Server = ***
# Service = ***
user ="dbo"
# Pass = ***
# SDE = 'E:C_Drive_filesAdministrator'311RequestdataServiceRequest.sde'
temploc = ""
fil = "SDETempConn"
env.overwriteOutput = True
#Create Version
print "Creating version"
arcpy.CreateVersion_management (GetSRConfig.SDEConnFile, Parent, version, "PUBLIC")
VersionName = user.upper() + "." + version
#Create new connection
workspace = os.path.join (temploc, fil + ".sde")
print workspace
#Layers
P6feature = os.path.join (workspace, P6featureName)
arcpy.MakeFeatureLayer_management (GetSRConfig.SDELayer, featureLyr)
#Start editing
print "Initiating editing"
edit = arcpy.da.Editor (GetSRConfig.SDEConnFile)
edit.startEditing ()
edit.startOperation()
#Test Cursor
print "Testing cursor"
P6Cursor = arcpy.da.UpdateCursor (featureLyr, ["VehicleNam"])
for row in P6Cursor:
print row[0]
del row
del P6Cursor
#Stop/save edits
edit.stopOperation()
print "Stopping editing"
edit.stopEditing("True")
#Switch to version
print "Switching version"
arcpy.ChangeVersion_management(featureLyr, "TRANSACTIONAL", Parent)
#Reconcile and post
print "Reconciling and posting"
arcpy.ReconcileVersions_management (GetSRConfig.SDEConnFile, "", Parent, VersionName, with_post = "POST", with_delete = "DELETE_VERSION")
arcpy cursor
Yes, you should create a new connection with the version... but I don't see why you need to do so, SDE allows multi-user editing. Is the data registered as versioned?
– Michael Stimson
Oct 15 '15 at 22:00
No the data isn't registered as version.
– Geoffrey West
Oct 15 '15 at 22:03
2
The state tree associated with versioning is database-wide (multiple versioned tables can have changes at the same state), but you can't perform versioned edits to a table which isn't registered as versioned, and you can't commit edits to a table which is locked by another session.
– Vince
Oct 15 '15 at 22:45
I too already had an SDE connection file, but a connect at esri told me to create the new one, hence why it's included in my answer. I haven't experimented with excluding it once I got the code working, however.
– Emil Brundage
Oct 15 '15 at 23:10
@EmilBrundage when creating the connection file, how should the parameters be set? My server is just an IP address, while I was assuming my service is SDE. My arcgis server sits on port 6080. I have tried using the IP address as the service name but I receive an error where it cannot connect. Please advise.
– Geoffrey West
Oct 15 '15 at 23:13
|
show 2 more comments
I am writing a script to use an updatecursor. The feature class is locked so I am versioning the database, creating a feature layer, and reconciling versions. I have taken the skeleton for my script from this thread. Debugging RuntimeError: workspace already in transaction mode from arcpy.da.UpdateCursor and ArcSDE feature classes?
The main difference is that I already had an SDE connection file in my directory. Should this be re-created each time the script is executed to avoid this error?
__author__ = 'Administrator'
from arcpy import *
import GetSRConfig
import os
import time
def GetDateTimeString(n = None):
""" format a datetime to string """
if(n==None):
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
else:
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
if((isNumeric(n)==True) and ((n>4) and (n<14))):
s = s[0:n]
else:
s = s[0:14]
return s
def isNumeric(s):
b = True
try:
i = float(s)
except: # not numericelse: # numeric
b= False
return b
#Locals
P6featureName = GetSRConfig.SDELayer
Parent = "dbo.DEFAULT"
version = "myVersion" + GetDateTimeString(12)
featureLyr = "lyr" + GetDateTimeString(12)
print version
# Server = ***
# Service = ***
user ="dbo"
# Pass = ***
# SDE = 'E:C_Drive_filesAdministrator'311RequestdataServiceRequest.sde'
temploc = ""
fil = "SDETempConn"
env.overwriteOutput = True
#Create Version
print "Creating version"
arcpy.CreateVersion_management (GetSRConfig.SDEConnFile, Parent, version, "PUBLIC")
VersionName = user.upper() + "." + version
#Create new connection
workspace = os.path.join (temploc, fil + ".sde")
print workspace
#Layers
P6feature = os.path.join (workspace, P6featureName)
arcpy.MakeFeatureLayer_management (GetSRConfig.SDELayer, featureLyr)
#Start editing
print "Initiating editing"
edit = arcpy.da.Editor (GetSRConfig.SDEConnFile)
edit.startEditing ()
edit.startOperation()
#Test Cursor
print "Testing cursor"
P6Cursor = arcpy.da.UpdateCursor (featureLyr, ["VehicleNam"])
for row in P6Cursor:
print row[0]
del row
del P6Cursor
#Stop/save edits
edit.stopOperation()
print "Stopping editing"
edit.stopEditing("True")
#Switch to version
print "Switching version"
arcpy.ChangeVersion_management(featureLyr, "TRANSACTIONAL", Parent)
#Reconcile and post
print "Reconciling and posting"
arcpy.ReconcileVersions_management (GetSRConfig.SDEConnFile, "", Parent, VersionName, with_post = "POST", with_delete = "DELETE_VERSION")
arcpy cursor
I am writing a script to use an updatecursor. The feature class is locked so I am versioning the database, creating a feature layer, and reconciling versions. I have taken the skeleton for my script from this thread. Debugging RuntimeError: workspace already in transaction mode from arcpy.da.UpdateCursor and ArcSDE feature classes?
The main difference is that I already had an SDE connection file in my directory. Should this be re-created each time the script is executed to avoid this error?
__author__ = 'Administrator'
from arcpy import *
import GetSRConfig
import os
import time
def GetDateTimeString(n = None):
""" format a datetime to string """
if(n==None):
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
else:
s = time.strftime("%Y%m%d%H%M%S", time.localtime())
if((isNumeric(n)==True) and ((n>4) and (n<14))):
s = s[0:n]
else:
s = s[0:14]
return s
def isNumeric(s):
b = True
try:
i = float(s)
except: # not numericelse: # numeric
b= False
return b
#Locals
P6featureName = GetSRConfig.SDELayer
Parent = "dbo.DEFAULT"
version = "myVersion" + GetDateTimeString(12)
featureLyr = "lyr" + GetDateTimeString(12)
print version
# Server = ***
# Service = ***
user ="dbo"
# Pass = ***
# SDE = 'E:C_Drive_filesAdministrator'311RequestdataServiceRequest.sde'
temploc = ""
fil = "SDETempConn"
env.overwriteOutput = True
#Create Version
print "Creating version"
arcpy.CreateVersion_management (GetSRConfig.SDEConnFile, Parent, version, "PUBLIC")
VersionName = user.upper() + "." + version
#Create new connection
workspace = os.path.join (temploc, fil + ".sde")
print workspace
#Layers
P6feature = os.path.join (workspace, P6featureName)
arcpy.MakeFeatureLayer_management (GetSRConfig.SDELayer, featureLyr)
#Start editing
print "Initiating editing"
edit = arcpy.da.Editor (GetSRConfig.SDEConnFile)
edit.startEditing ()
edit.startOperation()
#Test Cursor
print "Testing cursor"
P6Cursor = arcpy.da.UpdateCursor (featureLyr, ["VehicleNam"])
for row in P6Cursor:
print row[0]
del row
del P6Cursor
#Stop/save edits
edit.stopOperation()
print "Stopping editing"
edit.stopEditing("True")
#Switch to version
print "Switching version"
arcpy.ChangeVersion_management(featureLyr, "TRANSACTIONAL", Parent)
#Reconcile and post
print "Reconciling and posting"
arcpy.ReconcileVersions_management (GetSRConfig.SDEConnFile, "", Parent, VersionName, with_post = "POST", with_delete = "DELETE_VERSION")
arcpy cursor
arcpy cursor
edited Apr 13 '17 at 12:34
Community♦
1
1
asked Oct 15 '15 at 21:15
Geoffrey WestGeoffrey West
1,51231935
1,51231935
Yes, you should create a new connection with the version... but I don't see why you need to do so, SDE allows multi-user editing. Is the data registered as versioned?
– Michael Stimson
Oct 15 '15 at 22:00
No the data isn't registered as version.
– Geoffrey West
Oct 15 '15 at 22:03
2
The state tree associated with versioning is database-wide (multiple versioned tables can have changes at the same state), but you can't perform versioned edits to a table which isn't registered as versioned, and you can't commit edits to a table which is locked by another session.
– Vince
Oct 15 '15 at 22:45
I too already had an SDE connection file, but a connect at esri told me to create the new one, hence why it's included in my answer. I haven't experimented with excluding it once I got the code working, however.
– Emil Brundage
Oct 15 '15 at 23:10
@EmilBrundage when creating the connection file, how should the parameters be set? My server is just an IP address, while I was assuming my service is SDE. My arcgis server sits on port 6080. I have tried using the IP address as the service name but I receive an error where it cannot connect. Please advise.
– Geoffrey West
Oct 15 '15 at 23:13
|
show 2 more comments
Yes, you should create a new connection with the version... but I don't see why you need to do so, SDE allows multi-user editing. Is the data registered as versioned?
– Michael Stimson
Oct 15 '15 at 22:00
No the data isn't registered as version.
– Geoffrey West
Oct 15 '15 at 22:03
2
The state tree associated with versioning is database-wide (multiple versioned tables can have changes at the same state), but you can't perform versioned edits to a table which isn't registered as versioned, and you can't commit edits to a table which is locked by another session.
– Vince
Oct 15 '15 at 22:45
I too already had an SDE connection file, but a connect at esri told me to create the new one, hence why it's included in my answer. I haven't experimented with excluding it once I got the code working, however.
– Emil Brundage
Oct 15 '15 at 23:10
@EmilBrundage when creating the connection file, how should the parameters be set? My server is just an IP address, while I was assuming my service is SDE. My arcgis server sits on port 6080. I have tried using the IP address as the service name but I receive an error where it cannot connect. Please advise.
– Geoffrey West
Oct 15 '15 at 23:13
Yes, you should create a new connection with the version... but I don't see why you need to do so, SDE allows multi-user editing. Is the data registered as versioned?
– Michael Stimson
Oct 15 '15 at 22:00
Yes, you should create a new connection with the version... but I don't see why you need to do so, SDE allows multi-user editing. Is the data registered as versioned?
– Michael Stimson
Oct 15 '15 at 22:00
No the data isn't registered as version.
– Geoffrey West
Oct 15 '15 at 22:03
No the data isn't registered as version.
– Geoffrey West
Oct 15 '15 at 22:03
2
2
The state tree associated with versioning is database-wide (multiple versioned tables can have changes at the same state), but you can't perform versioned edits to a table which isn't registered as versioned, and you can't commit edits to a table which is locked by another session.
– Vince
Oct 15 '15 at 22:45
The state tree associated with versioning is database-wide (multiple versioned tables can have changes at the same state), but you can't perform versioned edits to a table which isn't registered as versioned, and you can't commit edits to a table which is locked by another session.
– Vince
Oct 15 '15 at 22:45
I too already had an SDE connection file, but a connect at esri told me to create the new one, hence why it's included in my answer. I haven't experimented with excluding it once I got the code working, however.
– Emil Brundage
Oct 15 '15 at 23:10
I too already had an SDE connection file, but a connect at esri told me to create the new one, hence why it's included in my answer. I haven't experimented with excluding it once I got the code working, however.
– Emil Brundage
Oct 15 '15 at 23:10
@EmilBrundage when creating the connection file, how should the parameters be set? My server is just an IP address, while I was assuming my service is SDE. My arcgis server sits on port 6080. I have tried using the IP address as the service name but I receive an error where it cannot connect. Please advise.
– Geoffrey West
Oct 15 '15 at 23:13
@EmilBrundage when creating the connection file, how should the parameters be set? My server is just an IP address, while I was assuming my service is SDE. My arcgis server sits on port 6080. I have tried using the IP address as the service name but I receive an error where it cannot connect. Please advise.
– Geoffrey West
Oct 15 '15 at 23:13
|
show 2 more comments
2 Answers
2
active
oldest
votes
You might want to check your license manager or your connection to same.
I have just started experiencing this problem in the middle of a python coding session. Things were working fine until all of the sudden I started pulling this error during 'import arcpy'.
Specifically on the env portion.
I have discovered that there is an issue between me and our license managers.
I am VPN'd into our network. When I remote to my desktop, all is well.
When I try to connect via ArcGIS Administrator to our two license managers, I get intermittent results.
I am the sysadmin for the LMs and when connected directly to them, they show no problem.
In my case, the issue is something related to the VPN tunnel and the LMs.
add a comment |
After spending hours for resolving this issue i have found following.
- Check if database is versioned or non versioned.
- Avoid using nested cursor. Make sure to release all cursors and row objects as soon as you are done with them.
- A small work around which i have used after struggling in nested cursor scenario:-
I had created layer object like this:arcpy.SelectLayerByAttribute_management(inputFC, 'my_lyr', ""FieldName" = '" + SearchValue+ "'")
and removed my search cursor. This served my purpose to avoid nested cursor scenario and i was started getting filtered objects then i used it to get my desire result set for(Both Insert and update operations). - If database in non versioned then then make sure you use following code.
edit.startEditing(True, False)
edit.startOperation()
- Use
With
keyword forwith arcpy.da.SearchCursor/arcpy.da.InsertCursor
cursor. This will make sure that your memory release appropriately without usingdel
keyword - if
edit.stopEditing()
operation giving you hard time(SystemError: error return without exception set: ) then comment it.(Funny but fact is my script worked if i run code from standalone way ex: command prompt or pyscriptor however as soon as i converted my script as GP service it started giving me error, so i have commentededit.stopEditing()
and moved on as data was saving in database), I believe its something with python version which is used in ArcMAP and ArcPy but never get the full explanation.
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f166706%2fworkspace-already-in-transaction-mode%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You might want to check your license manager or your connection to same.
I have just started experiencing this problem in the middle of a python coding session. Things were working fine until all of the sudden I started pulling this error during 'import arcpy'.
Specifically on the env portion.
I have discovered that there is an issue between me and our license managers.
I am VPN'd into our network. When I remote to my desktop, all is well.
When I try to connect via ArcGIS Administrator to our two license managers, I get intermittent results.
I am the sysadmin for the LMs and when connected directly to them, they show no problem.
In my case, the issue is something related to the VPN tunnel and the LMs.
add a comment |
You might want to check your license manager or your connection to same.
I have just started experiencing this problem in the middle of a python coding session. Things were working fine until all of the sudden I started pulling this error during 'import arcpy'.
Specifically on the env portion.
I have discovered that there is an issue between me and our license managers.
I am VPN'd into our network. When I remote to my desktop, all is well.
When I try to connect via ArcGIS Administrator to our two license managers, I get intermittent results.
I am the sysadmin for the LMs and when connected directly to them, they show no problem.
In my case, the issue is something related to the VPN tunnel and the LMs.
add a comment |
You might want to check your license manager or your connection to same.
I have just started experiencing this problem in the middle of a python coding session. Things were working fine until all of the sudden I started pulling this error during 'import arcpy'.
Specifically on the env portion.
I have discovered that there is an issue between me and our license managers.
I am VPN'd into our network. When I remote to my desktop, all is well.
When I try to connect via ArcGIS Administrator to our two license managers, I get intermittent results.
I am the sysadmin for the LMs and when connected directly to them, they show no problem.
In my case, the issue is something related to the VPN tunnel and the LMs.
You might want to check your license manager or your connection to same.
I have just started experiencing this problem in the middle of a python coding session. Things were working fine until all of the sudden I started pulling this error during 'import arcpy'.
Specifically on the env portion.
I have discovered that there is an issue between me and our license managers.
I am VPN'd into our network. When I remote to my desktop, all is well.
When I try to connect via ArcGIS Administrator to our two license managers, I get intermittent results.
I am the sysadmin for the LMs and when connected directly to them, they show no problem.
In my case, the issue is something related to the VPN tunnel and the LMs.
edited Apr 2 '16 at 1:29
PolyGeo♦
54k1782246
54k1782246
answered Apr 2 '16 at 0:51
pkdpkd
212
212
add a comment |
add a comment |
After spending hours for resolving this issue i have found following.
- Check if database is versioned or non versioned.
- Avoid using nested cursor. Make sure to release all cursors and row objects as soon as you are done with them.
- A small work around which i have used after struggling in nested cursor scenario:-
I had created layer object like this:arcpy.SelectLayerByAttribute_management(inputFC, 'my_lyr', ""FieldName" = '" + SearchValue+ "'")
and removed my search cursor. This served my purpose to avoid nested cursor scenario and i was started getting filtered objects then i used it to get my desire result set for(Both Insert and update operations). - If database in non versioned then then make sure you use following code.
edit.startEditing(True, False)
edit.startOperation()
- Use
With
keyword forwith arcpy.da.SearchCursor/arcpy.da.InsertCursor
cursor. This will make sure that your memory release appropriately without usingdel
keyword - if
edit.stopEditing()
operation giving you hard time(SystemError: error return without exception set: ) then comment it.(Funny but fact is my script worked if i run code from standalone way ex: command prompt or pyscriptor however as soon as i converted my script as GP service it started giving me error, so i have commentededit.stopEditing()
and moved on as data was saving in database), I believe its something with python version which is used in ArcMAP and ArcPy but never get the full explanation.
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
add a comment |
After spending hours for resolving this issue i have found following.
- Check if database is versioned or non versioned.
- Avoid using nested cursor. Make sure to release all cursors and row objects as soon as you are done with them.
- A small work around which i have used after struggling in nested cursor scenario:-
I had created layer object like this:arcpy.SelectLayerByAttribute_management(inputFC, 'my_lyr', ""FieldName" = '" + SearchValue+ "'")
and removed my search cursor. This served my purpose to avoid nested cursor scenario and i was started getting filtered objects then i used it to get my desire result set for(Both Insert and update operations). - If database in non versioned then then make sure you use following code.
edit.startEditing(True, False)
edit.startOperation()
- Use
With
keyword forwith arcpy.da.SearchCursor/arcpy.da.InsertCursor
cursor. This will make sure that your memory release appropriately without usingdel
keyword - if
edit.stopEditing()
operation giving you hard time(SystemError: error return without exception set: ) then comment it.(Funny but fact is my script worked if i run code from standalone way ex: command prompt or pyscriptor however as soon as i converted my script as GP service it started giving me error, so i have commentededit.stopEditing()
and moved on as data was saving in database), I believe its something with python version which is used in ArcMAP and ArcPy but never get the full explanation.
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
add a comment |
After spending hours for resolving this issue i have found following.
- Check if database is versioned or non versioned.
- Avoid using nested cursor. Make sure to release all cursors and row objects as soon as you are done with them.
- A small work around which i have used after struggling in nested cursor scenario:-
I had created layer object like this:arcpy.SelectLayerByAttribute_management(inputFC, 'my_lyr', ""FieldName" = '" + SearchValue+ "'")
and removed my search cursor. This served my purpose to avoid nested cursor scenario and i was started getting filtered objects then i used it to get my desire result set for(Both Insert and update operations). - If database in non versioned then then make sure you use following code.
edit.startEditing(True, False)
edit.startOperation()
- Use
With
keyword forwith arcpy.da.SearchCursor/arcpy.da.InsertCursor
cursor. This will make sure that your memory release appropriately without usingdel
keyword - if
edit.stopEditing()
operation giving you hard time(SystemError: error return without exception set: ) then comment it.(Funny but fact is my script worked if i run code from standalone way ex: command prompt or pyscriptor however as soon as i converted my script as GP service it started giving me error, so i have commentededit.stopEditing()
and moved on as data was saving in database), I believe its something with python version which is used in ArcMAP and ArcPy but never get the full explanation.
After spending hours for resolving this issue i have found following.
- Check if database is versioned or non versioned.
- Avoid using nested cursor. Make sure to release all cursors and row objects as soon as you are done with them.
- A small work around which i have used after struggling in nested cursor scenario:-
I had created layer object like this:arcpy.SelectLayerByAttribute_management(inputFC, 'my_lyr', ""FieldName" = '" + SearchValue+ "'")
and removed my search cursor. This served my purpose to avoid nested cursor scenario and i was started getting filtered objects then i used it to get my desire result set for(Both Insert and update operations). - If database in non versioned then then make sure you use following code.
edit.startEditing(True, False)
edit.startOperation()
- Use
With
keyword forwith arcpy.da.SearchCursor/arcpy.da.InsertCursor
cursor. This will make sure that your memory release appropriately without usingdel
keyword - if
edit.stopEditing()
operation giving you hard time(SystemError: error return without exception set: ) then comment it.(Funny but fact is my script worked if i run code from standalone way ex: command prompt or pyscriptor however as soon as i converted my script as GP service it started giving me error, so i have commentededit.stopEditing()
and moved on as data was saving in database), I believe its something with python version which is used in ArcMAP and ArcPy but never get the full explanation.
edited 20 mins ago
answered Sep 24 '18 at 8:52
Bhaskar SinghBhaskar Singh
466
466
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
add a comment |
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
What do you mean by change parameter accordingly!? What do you change it to?
– Steve
yesterday
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
@Steve Since you would be doing edit operation in versioned database so you have option to set "undo" and "multiuser_mode" property.ESRI link.
– Bhaskar Singh
47 mins ago
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f166706%2fworkspace-already-in-transaction-mode%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Yes, you should create a new connection with the version... but I don't see why you need to do so, SDE allows multi-user editing. Is the data registered as versioned?
– Michael Stimson
Oct 15 '15 at 22:00
No the data isn't registered as version.
– Geoffrey West
Oct 15 '15 at 22:03
2
The state tree associated with versioning is database-wide (multiple versioned tables can have changes at the same state), but you can't perform versioned edits to a table which isn't registered as versioned, and you can't commit edits to a table which is locked by another session.
– Vince
Oct 15 '15 at 22:45
I too already had an SDE connection file, but a connect at esri told me to create the new one, hence why it's included in my answer. I haven't experimented with excluding it once I got the code working, however.
– Emil Brundage
Oct 15 '15 at 23:10
@EmilBrundage when creating the connection file, how should the parameters be set? My server is just an IP address, while I was assuming my service is SDE. My arcgis server sits on port 6080. I have tried using the IP address as the service name but I receive an error where it cannot connect. Please advise.
– Geoffrey West
Oct 15 '15 at 23:13