Serialization error passing an Ontology object into an AIP Logic Function exposed via OSDK

I have an AIP Logic function that accepts an Ontology object as input. I have an Application SDK that exposes both the Ontology object set and the AIP Logic function. When I query the Object set to select a single object and pass that object into the AIP Logic function remotely, I get the following serialization error:

Object of type Ace is not JSON serializable
  File "/home/user/data-at-acke-transformations/python/automation/ace_model_conversion/convert_ace_to_dbt.py", line 13, in convert_ace_model_to_dbt_model
    dbt_model = client.ontology.queries.cconver_ace_to_dbt_beta(ace_model=foundry_ace_model)
  File "/home/user/data-at-acme-transformations/python/automation/ace_model_conversion/execute.py", line 5, in <module>
    convertAceToDbt.convert_ace_model_to_dbt_model()
TypeError: Object of type Ace is not JSON serializable

Can you please share the line of code you call the function and the parameter declaration ahead of it?

                client = Config.get_foundry_client()
                foundry_ace_model = client.ontology.objects.Ace.get(ace_model["sql_model_name"])
                dbt_model = client.ontology.queries.cconver_ace_to_dbt_beta(ace_model=foundry_ace_model)

Hi @Natrix! I think I’ve found the bug. The fix probably won’t be in until next week. in the meantime, can you try inputing the primary_key of the object to your query instead of the object itself?
e.g.
client.ontology.queries.cconver_ace_to_dbt_beta(ace_model=foundry_ace_model.get_primary_key())

Thanks @jzhang. I tried to use the primary key like you suggested as am now getting this internal error. I am unable to see the actual error. (See Below)

dbt_model = client.ontology.queries.cconver_ace_to_dbt_beta(ace_model=foundry_ace_model.get_primary_key())
{
    "errorCode": "INTERNAL",
    "errorInstanceId": "331b39e5-d931-4837-979e-8ef18a3a293d",
    "errorName": "Default:Internal",
    "parameters": {}
}

Hmm a few quesions:

  • Is the function able to execute in AIP Logic for some example object? Like, have you been able to execute the function before using the UI?
  • Also, how did you construct your client? (get_foundry_client() ) Was this based off the docs in developer console? Are you using ConfidentialClientAuth?