|
POST
|
On line 9, you have an udefined variable fld in AddFieldDelimiters(). It also gives TypeError: AddFieldDelimiters() takes exactly 2 arguments (1 given) It needs a data source, then field name. AddFieldDelimiters—Help | ArcGIS for Desktop
... View more
08-17-2015
09:43 AM
|
1
|
1
|
2479
|
|
POST
|
Sorry to keep derailing this topic, but do you have any suggestions on how to effectively search the new ArcGIS Help? My Google-Fu is strong with finding 10.1-10.2 stuff but Google never seems to return results from the "current" 10.3 site.
... View more
08-17-2015
08:55 AM
|
0
|
1
|
3342
|
|
POST
|
Since this is a 10.3 issue, I agree, use 10.3 links. However, if you copy/paste the url Ian posted, it works. The GeoNet forums just don't handle it correctly. Alternatively, you can click the email link in the upper right of the 10.1-10.2 help page to get a "cleaner" url that seems to work in GeoNet. ArcGIS Help 10.2 - Delete (Data Management)
... View more
08-14-2015
03:33 PM
|
1
|
4
|
3342
|
|
POST
|
This sounds like something that has been discussed many other times (three by you in the past month). Is this thread for 2CDSD 2C or Paco ALVAREZ?
... View more
08-14-2015
01:56 PM
|
1
|
2
|
2242
|
|
POST
|
You'll need to contact the people who can log in as those users to help you out. If they aren't around any more, you may be able to create the account again and use it to delete the domains owned by that person. If their account is still there but the person has left, just reset their password, connect with their account, complete your maintenance, then delete the account.
... View more
08-14-2015
01:39 PM
|
0
|
0
|
3690
|
|
POST
|
When you say the owner is long gone, do you mean the user account was deleted?
... View more
08-14-2015
12:32 PM
|
0
|
2
|
3690
|
|
POST
|
Looking at this again, I'm not sure I'm on the right track. I see you've got a couple cursors open and I can't follow what the goal is. Could you please clarify (maybe with a screenshot) what exactly you're trying to do here? basically i am trying to create multiple points that spatially joins the new created points to parcels and updates the points attributes based on what parcel the points are created i am not sure why i am getting the following error.
... View more
08-14-2015
12:27 PM
|
2
|
4
|
2243
|
|
POST
|
This looks like a problem to me. with arcpy.da.SearchCursor(point,('Account','SiteAddres','SiteNum','StreetName', 'SiteStreet', 'SiteNumSfx','Predir', 'Postdir', 'SiteCity', 'SiteZip', 'OwnerName')) as cursor:
for row in cursor:
row = []
insCursor.insertRow(row) You're trying to insert an empty row. I think you need the same number of values in the row list as there are fields in the cursor. If you're trying to just insert a blank row, fill the values with nulls (or defaults if nulls not allowed). Maybe something like this? row = [
None, ## Account
None, ## SiteAddres
None, ## SiteNum
None, ## StreetName
None, ## SiteStreet
None, ## SiteNumSfx
None, ## Predir
None, ## Postdir
None, ## SiteCity
None, ## SiteZip
None ## OwnerName
]
... View more
08-14-2015
08:20 AM
|
1
|
7
|
3283
|
|
POST
|
I think you can still delete unused domains regardless of the geodatabase locks that may exist. Worth a shot.
... View more
08-14-2015
08:13 AM
|
1
|
1
|
6761
|
|
POST
|
I've never tried using GitHub, but you're welcome to spread the love there if you like. Be sure to post a link if you do!
... View more
08-14-2015
08:11 AM
|
2
|
2
|
6761
|
|
POST
|
That's a great point, Ruchira Welikala. I had only tested this with a file geodatabase, but the issue you are describing is absolutely correct with SDE; you need to be the owner. Conveniently, I've also been working on an SDE maintenance script that will reconcile versions, compress, rebuild indexes, and analyze datasets (source inspiration). For those last two tools, you need to run them as the data owner. My solution (for SDE in Oracle 11g): Get all the distinct owner names from the domain objects For each owner, create a temporary sde connection file. Then use that temporary connection file to run whatever task you need (delete domain in this case). Here is my final code that will remove unused domains from both local and remote (SDE) geodatabases. You will need to figure out a way to generate the password if it is different for each owner. Please test it out and let me know how it works for you. import arcpy
from contextlib import contextmanager
import os
import shutil
import tempfile
def main():
try:
# Connection path to geodatabse (as administrator if SDE)
myGDB = r"C:\GISConnections\[email protected]"
# Get domains that are assigned to a field
domainsUsed_names = []
for dirpath, dirnames, filenames in arcpy.da.Walk(myGDB, datatype=["FeatureClass", "Table"]):
for filename in filenames:
print "Checking {}".format(os.path.join(dirpath, filename))
## Check for normal field domains
for field in arcpy.ListFields(os.path.join(dirpath, filename)):
if field.domain:
domainsUsed_names.append(field.domain)
## Check for domains used in a subtype field
subtypes = arcpy.da.ListSubtypes(os.path.join(dirpath, filename))
for stcode, stdict in subtypes.iteritems():
if stdict["SubtypeField"] != u'':
for field, fieldvals in stdict["FieldValues"].iteritems():
if not fieldvals[1] is None:
domainsUsed_names.append(fieldvals[1].name)
## end for subtypes
## end for filenames
## end for geodatabase Walk
# List of all existing domains (as domain objects)
domainsExisting = arcpy.da.ListDomains(myGDB)
# Find existing domain names that are not in use (using set difference)
domainsUnused_names = (
set([dom.name for dom in domainsExisting]) - set(domainsUsed_names)
)
# Get domain objects for unused domain names
domainsUnused = [
dom for dom in domainsExisting
if dom.name in domainsUnused_names
]
print "{} unused domains in {}".format(len(domainsUnused), myGDB)
# Cleanup
del domainsExisting
del domainsUnused_names
# Delete unused domains by owner
## For local geodatabses, owner is an empty string ('')
with makeTempDir() as temp_dir:
descGDB = arcpy.Describe(myGDB)
for owner in set([dom.owner for dom in domainsUnused]):
if descGDB.workspaceType == "RemoteDatabase":
## Use temporary SDE connection as owner
myGDB = arcpy.CreateDatabaseConnection_management(
temp_dir, ## out_folder_path
owner+".sde", ## out_name
"ORACLE", ## database_platform
"GISTEST.WORLD", ## instance
"DATABASE_AUTH", ## account_authentication
owner, ## username
"myuserpass", ## password
)
print arcpy.GetMessages()
## Format result object as string for path to connection file
myGDB = str(myGDB)
# Get unused domains for current owner
domainsUnused_currentOwner = [
dom.name for dom in domainsUnused
if dom.owner == owner
]
for domain in domainsUnused_currentOwner:
arcpy.DeleteDomain_management(myGDB, domain)
print "\t{} deleted".format(domain)
## end for domainsExisting_owners
## end with temp_dir
finally:
# Cleanup
arcpy.ClearWorkspaceCache_management()
@contextmanager
def makeTempDir():
"""Creates a temporary folder and returns the full path name.
Use in with statement to delete the folder and all contents on exit.
Requires contextlib contextmanager, shutil, and tempfile modules.
"""
temp_dir = tempfile.mkdtemp()
try:
yield temp_dir
finally:
shutil.rmtree(temp_dir)
if __name__ == '__main__':
main()
... View more
08-13-2015
03:38 PM
|
2
|
11
|
6761
|
|
POST
|
With this in mind, you could either rename your geodatabase table and dataset so they are unique, or make a table view of the table using a where clause that will not return any rows (for speed/performance) and do a describe on the view. where_clause = "1=0" ## Intentionally will not return any rows
arcpy.MakeTableView_management(inTable, "outTableView", where_clause)
descView = arcpy.Describe("outTableView")
print descView.name, descView.datasetType
... View more
08-11-2015
09:38 AM
|
1
|
1
|
3735
|
|
POST
|
I'm not sure about performance, but my first reaction is to keep it clean and remove the unused domains. We have a similar issue (although not this severe) but we haven't yet decided how to proceed. I I know you can create something, but I thought I would share what I came up with to identify unused domains and delete them. I noticed when testing that by default it didn't look for domains in subtypes so I had to code some extra for that. Maybe it'll help you. Delete Unused Domains
... View more
08-06-2015
03:57 PM
|
1
|
1
|
1341
|
|
POST
|
If it doesn't have to be on the entire geodatabase, you could try using TestSchemaLock() on the feature class or table before attempting to do something with it.
... View more
08-06-2015
03:17 PM
|
1
|
0
|
2367
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Friday | |
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM |