wysorj

Problems with MakeQueryTable_management in code

Discussion created by wysorj on Apr 5, 2013
I am having trouble getting the code below to execute succesfully:

import arcpy

tableList = ['Database Connections\\Metering_Data.odc\\tblFlowMeters', \
             'Database Connections\\Metering_Data.odc\\tblDataCollectionPeriods', \
             'Database Connections\\Metering_Data.odc\\tblFlowMeterDataCollectionPeriods', \
             'Database Connections\\Metering_Data.odc\\tblMeteringData']

fieldList = [['tblFlowMeters.MeterName'], ['tblDataCollectionPeriods.StartDate', \
              'tblDataCollectionPeriods.EndDate'], ['tblMeteringData.MeteringDataId', \
              'tblMeteringData.MeteringDateTime', 'tblMeteringData.DepthInches', \
              'tblMeteringData.VelocityFTperSec', 'tblMeteringData.FlowMGD', \
              'tblMeteringData.RainInches','tblMeteringData.DebrisInches']]

whereClause = "(tblFlowMeters.FlowMeterId = tblFlowMeterDataCollectionPeriods.FlowMeterId \
               AND tblFlowMeterDataCollectionPeriods.DataCollectionPeriodsId =  \
               tblDataCollectionPeriods.DataCollectionPeriodsId AND \
               tblDataCollectionPeriods.DataCollectionPeriodsId = \
               tblMeteringData.DataCollectionPeriodId AND \
               tblFlowMeterDataCollectionPeriods.FlowMeterIdDataCollectionPeriodsId \
               = tblMeteringData.FlowMeterDataCollectionPeriodsId ) AND \
               (tblFlowMeters.MeterName = 'RH2A')"

arcpy.MakeQueryTable_management(tableList, "tblFlowMetersTest7", "USE_KEY_FIELDS", "tblMeteringData.MeteringDataId", fieldList, whereClause)


I get the following error message when I run it:
Traceback (most recent call last):
  File "<string>", line 73, in execInThread
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 196, in __call__
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 71, in syncreq
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 431, in sync_request
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 379, in serve
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 337, in _recv
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\channel.py", line 50, in recv
  File "C:\Program Files\PyScripter\Lib\rpyc.zip\rpyc\core\stream.py", line 166, in read
EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host


If I run the code without the fieldList variable, the code runs succesfully.  Is there something wrong with my fieldList variable that I am not seeing?

I can run the MakeQueryTable_managment toolbox in ArcMap with all the same values successfully.  It also runs if I do it via a model.  When I export the model to a script it also runs successfully.

Anyone have an idea why my fieldList variable wont' allow it to run?

Outcomes