Omni's Query API (Beta)
Beta
This feature is in beta and may have some breaking changes in the future to clean up the query interface properties.
If you want to pull data out of Omni to benefit from the governed data in other applications (like into a python notebook for a data science use case), you can leverage the Query API:
- Create an API key
- Create a query in a workbook you want to reference
- Select in the menu View > Inspector (⌥9 keyboard shortcut)
- If you look in the inspector on the far right hand side for "Query Structure" copy the JSON object for an example of how the query should be structured
- Issue a post request using the query structure. It should look something like:
curl -X POST https://api.example.com/api/unstable/query/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-data '{
“query”: {
"limit": 1000,
"sorts": [
{
"column_name": "example_field3",
"is_column_sort": false,
"sort_descending": false
}
],
"table": "example_table",
"fields": [
"example_field1",
"example_field2"
],
"modelId": "example_long_string_with_letters_and_numbers",
"join_paths_from_topic_name": "example_topic_name"
}
}'
- Once you run the request, Omni will pass the data down as Apache arrow payload in the result property. Make sure the data is returning the same information as you see in the Omni query you created.
See the python SDK for an example of the query lifecycle and processing the arrow payload here.
Troubleshooting
If the request takes too long, the api will pass back a remaining_job_ids
back.
You can poll the query wait end point until timeout
property is false
curl https://api.example.com/api/unstable/query/wait?job_ids=[remaining_job_ids]