Add Fields to a joined table in memory

909
3
06-18-2019 03:28 PM
JoeBorgione
MVP Emeritus

I'm working on a python script in which I create a couple of tables in memory, and then join them.  Then joined table will then be joined to a polygon feature class (that join is in memory as well) and finally the joined layer with all the joined attributes gets appended to a polygon feature class on disc.

The problem is with the append: I've never been able to figure out field mapping in arcpy, and I'd prefer staying away from it. The polygon feature class on disc has four fields that also exist in the two individual tables:

zipcode, month, year, clientCount, deliveryCount; client Count is in one table, deliveryCount the other. When I join them the field names change to tableName.fieldname:

table1.zipcode

table2.zipcode

table1.month

table2.month

table1.year

table2.year

table1.clientCount

table2.deliveryCount

I have tried to add additional fields to the joined table, (Zipcode, Month,Year,ClientCount,DeliveryCount) in hopes of making the subsequent append work smoothly, but when I try to add the fields I get an error saying it can't get an exclusive schema lock. Rats....

Is there anyway to avoid field mapping at this point?

That should just about do it....
0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

You tried adding the fields prior to doing the join? 

0 Kudos
JoeBorgione
MVP Emeritus

The idea us to get the delivery count and client count into one table via the join. The two original tables are identical except for those respective fields. I think i may just copy the in memory joined table to disc in a scratch fgdb, add the fields and populate them, and then  join it to the polygons.

That should just about do it....
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Is this Pro or ArcMap?  If Pro, which in-memory workspace are you using?

0 Kudos