RelationalAI / rai-sdk-python

The RelationalAI Software Development Kit (SDK) for Python.
Apache License 2.0
17 stars 4 forks source link

Return the entire JSON response for get_transaction_metadata.py #73

Closed salamehsameera closed 2 years ago

salamehsameera commented 2 years ago

get_transaction_metadata returns a list, not a single item. For example, running {:x, 2; :y, 3} query produces a list of two items:

[
  {
    "relationId": "/:output/:x/Int64",
    "types": [
      ":output",
      ":x",
      "Int64"
    ]
  },
  {
    "relationId": "/:output/:y/Int64",
    "types": [
      ":output",
      ":y",
      "Int64"
    ]
  }
]

However, the python SDK is failing because get_transaction_metadata calls _get_resource function, which fails at the assert len(rsp) == 1 condition. Fixing this by calling _get_collection instead of _get_resource. I also renamed _list_collection to _get_collection because I think it makes more sense.

salamehsameera commented 2 years ago

This causes failures in other examples like create_engine, looking into this