CodeEngine: JSONDecodeError

Hi All,

I'm looking to query datasets from within code engine (a similar function exists but avoiding calling codeengine within codeengine to use that function)

def new_users(dataSetId="insert"):
  url = f"https://api.domo.com/v1/datasets/query/execute/{dataSetId}"
  body = {"sql": "SELECT * FROM 'table_name'"}
  response = codeengine.send_request('post', url,body=body,headers=None, contentType="application/json")
  return response

The working pydomo equivilent is

from pydomo import Domo
domo = Domo(client_id,client_secret,url)
domo.datasets.query(table,query)

PyDomo throws error in code engine.

Documentation:
https://developer.domo.com/portal/52fd0777839f4-query-a-data-set

https://developer.domo.com/portal/35115c5c48927-datasets-api

Error(s) returned:

Pydomo:

JSONDecodeError at line 29 of /var/task/app.py: Expecting value: line 1 column 1 (char 0)
ModuleNotFoundError at line 62 of /var/task/executor.py: No module named 'pydomo Code Engine: JSONDecodeError at line 41 of /var/task/executor.py: Expecting value: line 1 column 1 (char 0)

Code Engine Configuration

Input: TEXT
Output: OBEJECT

Tagged:

Answers

  • brycec
    brycec Contributor

    Have you tried removing the import statement? Code Engine is weird and it might just be built in and allow you to call that Domo function without the import statement. Otherwise, you can use the requests package instead the Python SDK.

    Was this comment helpful? Click Agree or Like below.
    Did this comment solve your problem? Accept it as the solution!