evalMetricsWithMetadata error in python


#1

The following metric works in console, not in python. Server version 7.8. Connector is c3remote_bootstrap.py

tsd = c3.TSDecl(
    data = "hpuJobs",
    start = "materials.usedOn",
    treatment = "SUM",
    filter = "materials.itemNum == 'XXX'",
    value = 1
)

m = c3.SimpleMetric(
  id = "HPURegulatorReplacementEvent_OilGasWell",
  name = "HPURegulatorReplacementEvent",
  srcType = "OilGasWell",
  path = "slotConnections.to.hpu.assetConnections.from",
  tsDecl = tsd
)

c3.OilGasWell.evalMetricsWithMetadata(
    spec = {
        "ids": ["XXX"], 
        "expressions": ["HPURegulatorReplacementEvent"],
        "start": "2016-03-01",
        "end": "2016-04-01",
        "interval": "DAY"
    }, 
    evalMetricsWithMetadata = [m]
)

Error is:

C3RuntimeException: 400 - BadField - c3.love.typesys.obj.pipe.ObjValueIteratorBase_badField [9749.1526]
message: "Invalid field name evalMetricsWithMetadata for type ApiRequestEntity at JSON document at 1:160"
JSON: {'spec': {'start': '2016-03-01', 'expressions': ['HPURegulatorReplacementEvent'], 'interval': 'DAY', 'end': '2016-04-01', 'ids': ['XXX']}, 'evalMetricsWithMetadata': [SimpleMetric({'tsDecl': TSDecl({'data': 'hpuJobs', 'value': 1, 'filter': "materials.itemNum == 'XXX'", 'start': 'materials.usedOn', 'treatment': 'SUM', 'type': u'TSDecl'}), 'name': 'HPURegulatorReplacementEvent', 'srcType': 'OilGasWell', 'path': 'slotConnections.to.hpu.assetConnections.from', 'type': u'SimpleMetric', 'id': 'HPURegulatorReplacementEvent_OilGasWell'})]}

What is wrong with my python syntax?


#2

The name of the second parameter is overrideMetrics and not evalMetricsWithMetadata.


#3

:smiley: thanks and my bad