MakeTableView in python script fails after Update to 10.3.1 on 64 bit OS

8689
26
12-23-2015 04:15 PM
JessicaFraver1
New Contributor III

Hi,

Since upgrading ArcGIS Desktop from 10.2.2 to 10.3.1, we receive a new error in our python scripts that use MakeTableView -      arcpy.MakeTableView_management(sourcewrkspc + sourcedata, "in_memory\\" + layer, whereclause).

The script error is as follows:

ERROR 000358: Invalid expression

Failed to execute (MakeTableView).

Further tests revealed that the arcpy.MakeTableView does not work on tables with no OBJECTID. Registering the table with the database generates an OBJECTID and gets rid of the error, but this is not an option for some of our tables.

Has anyone experienced this problem with 10.3.1 and know why this error happens? Is there a fix besides creating a workaround to add an OBJECTID?

Thank you!

0 Kudos
26 Replies
DanPatterson_Retired
MVP Emeritus

Nothing indicated here Make Table View—Help | ArcGIS for Desktop

But the procedure is described here and MakeTableView is the route to do so... Fundamentals of ObjectID fields—Help | ArcGIS for Desktop and be sure to check the sublinks.

Did you try it somewhere else than in-memory? or perhaps without a whereclause to narrow down whether it is for some inputs, all, or a combination?

0 Kudos
AlisonGaiser1
Occasional Contributor

Jessica,

We are experiencing the same issue here. We also cannot add an OBJECTID to the table we are accessing.

Did you find any other fixes or workarounds?

Thanks,

     Alison

0 Kudos
JessicaFraver1
New Contributor III

Hi Alison,

Unfortunately, we still don't understand what happened to make either the tables/views without an object ID, or the MakeTableVIew tool, behave differently with 10.3.1. We ended up adding a step in the script to search for the ObjectID field. If there is an ObjectID proceed with MakeTableView, if no ObjectID, CopyRows to in-memory. The remainder of the script is the same. This in not ideal for several reasons, but it works for us for now.

In response to Dan's reply:

"Did you try it somewhere else than in-memory? or perhaps without a whereclause to narrow down whether it is for some inputs, all, or a combination?"

We tried modifying output location and whereclause in different combinations, but nothing worked.

If you find another workaround, or potential cause of this error, can you please post it? I will do the same.

Thank you,

Jessica

0 Kudos
Kathleen_Crombez
Occasional Contributor III

I have run into the same error using the arcpy.MakeTableView_management function on a feature class that HAS and OBJECTID field.

I am also using a where clause in the function.

The script runs perfectly in 10.2 but fails on this function in 10.3

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Can you provide an example of a where clause that fails?

0 Kudos
Kathleen_Crombez
Occasional Contributor III

Joshua Bixby​,

It is strange, because I have other MakeTableView statements with a where clause that run before this one and they all run fine.

This is the line that throws the error in 10.3

Here is the error

Here are the field properties of the Summary_CondoPin table

One thing I did notice about the Summary_CondoPin table is the where clause returns zero records. So maybe that has something to do with the error.

But as I mentioned before, this line runs fine without error in 10.2

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

A few questions:

  • Everything between 10.2.x and 10.3.x is the same?
    • Background processing enabled/disabled for both?
    • 64-bit Geoprocessing installed/not for both?
    • If connecting to SDE, same DMBS drivers installed for both?
  • What is the backend storage for the Summary_CondoPin table?
  • What does ArcPy.AddFieldDelimiter return for field delimiters?

Although using AddFieldDelimiter feels anal retentive at times, it is the most robust way of building expressions so they are transferrable across multiple data stores.  Does using the following work?

arcpy.MakeTableView_management(
    Summary_CondoPin,
    'Frequency_CondoPin',
    """{} > 1 AND {} IS NULL""".format(arcpy.AddFieldDelimiters(Summary_CondoPin,
                                                                'FREQUENCY'),
                                       arcpy.AddFieldDelimiters(Summary_CondoPin,
                                                                'Comment')))
0 Kudos
Kathleen_Crombez
Occasional Contributor III

The machine running 10.2.2 has Windows Server 2008 R2 Enterprise 64-bit OS. (Virtual)

The python shell launches as Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32

The machine running 10.3.1 has Windows 7 Professional 64-bit OS.

The python shell launches as Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32

I'm not certain how to test for background processing. Both machine were set up with the standard install.

The script was written on the Windows 7 machine before upgrading from 10.2.2 to 10.3.1

The Summary_CondoPin table is in a file geodatabase located on a Windows Server 2012 R2 Standard 64-bit OS.

print """{} > 1 AND {} IS NULL""".format(arcpy.AddFieldDelimiters(Summary_CondoPin, 'FREQUENCY'), arcpy.AddFieldDelimiters(Summary_CondoPin, 'Comment'))

Returned FREQUENCY > 1 AND Comment IS NULL

Using the syntax you provided me for the MakeTableView failed with the same error.

Traceback (most recent call last):

  File "X:\ParcelFeaturesQC\ParcelFeaturesQC.py", line 676, in <module>

    startArcSDE(True)

  File "X:\ParcelFeaturesQC\ParcelFeaturesQC.py", line 619, in startArcSDE

    QC.runCondoPinCheck()

  File "X:\ParcelFeaturesQC\ParcelFeaturesQC.py", line 519, in runCondoPinCheck

    arcpy.MakeTableView_management(Summary_CondoPin,'Frequency_CondoPin', """{} > 1 AND {} IS NULL""".format(arcpy.AddFieldDelimiters(Summary_CondoPin, 'FREQUENCY'), arcpy.AddFieldDelimiters(Summary_CondoPin, 'Comment')))

  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 7047, in MakeTableView

    raise e

ExecuteError: ERROR 000358: Invalid expression

Failed to execute (MakeTableView).

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I tested some variations of your situation in 10.3.1 using file geodatabases, and I don't run into that error.  At this point, all I can suggest is going down the Esri Support incident route.

0 Kudos