update cursor invalid sql statement

5170
17
Jump to solution
03-11-2016 09:01 AM
BrianLomas
Occasional Contributor III

I'm new to python so forgive me if this seems like a dumb question... I work for the city and we get parcel information monthly from the county. Usually the data comes in a text file which I then put in an mdb. I'm trying to write some code to run an update our layers with the updated monthly information. Currently, I've just been trying to get a few fields to update  inside a 'test' file geodatabase but I'm stuck. I get the following error message with the following code. Any ideas?

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

You could use a dictionary with a list of values, in stead of a dictionary with a single field as value. This would require some changes in building the dictionary and the way the values are retrieved in the update cursor, but it can be done. If the code you tested was fast, it means that you don't have that many features to process. In that case it would not be a problem to create this larger dictionary (with lists as values).

View solution in original post

17 Replies
DarrenWiens2
MVP Honored Contributor

Not sure about the rest, but you don't have the same number of single and double quotes.

BrianLomas
Occasional Contributor III

Oops I forgot I corrected that one... When that is taken out I get the following error...

Runtime error

Traceback (most recent call last):

  File "<string>", line 9, in <module>

RuntimeError: An invalid SQL statement was used. [Parcel_092015COPY]

0 Kudos
DarrenWiens2
MVP Honored Contributor

Try building your SQL expression in a previous line, then printing it to confirm that it is what you think it is.

0 Kudos
WesMiller
Regular Contributor III

Have you tried doing this in model builder. Most everything you'll need should be in there and it will give you a head start if you need to do any coding.

What is ModelBuilder?—Help | ArcGIS for Desktop

0 Kudos
BrianLomas
Occasional Contributor III

I thought about model builder but this will run for more than 10,000 features so I was worried about it being too slow. Although, I'm not too familiar with MB so I may be  wrong.

0 Kudos
DanPatterson_Retired
MVP Emeritus

are your fields really  situs and current_ow  or those supposed to be sites and current_row which I did a brain translation to until I looked again

BrianLomas
Occasional Contributor III

yea, 'situs' and 'current_ow' are actual field names.

0 Kudos
DanPatterson_Retired
MVP Emeritus

just checking sometimes it is the little things...

0 Kudos
WesMiller
Regular Contributor III

10,000 features wouldn't be a problem. You could simply join the 2 tables then use field calculator.

0 Kudos