AnsweredAssumed Answered

Problems with MakeQueryTable_management in code

Question asked by wysorj on Apr 5, 2013
Latest reply on Apr 8, 2013 by wysorj
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\core\", line 196, in __call__   File "C:\Program Files\PyScripter\Lib\\rpyc\core\", line 71, in syncreq   File "C:\Program Files\PyScripter\Lib\\rpyc\core\", line 431, in sync_request   File "C:\Program Files\PyScripter\Lib\\rpyc\core\", line 379, in serve   File "C:\Program Files\PyScripter\Lib\\rpyc\core\", line 337, in _recv   File "C:\Program Files\PyScripter\Lib\\rpyc\core\", line 50, in recv   File "C:\Program Files\PyScripter\Lib\\rpyc\core\", 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?