Concept | API query enrichments#
Watch the video
Let’s discuss API query enrichment in Dataiku.
Definition#
In some cases, an API request to an endpoint will not include all features required for processing the request. In such cases, a query enrichment — that is, a lookup on another table — may be able to retrieve the additional features needed for the endpoint to process the request and return a valid response.
Example#
In a credit card fraud detection use case, at the time of the transaction, the client making the API request could know the transaction amount, but might not have any information on the cardholder’s FICO score, a measure of creditworthiness in the US.
Since the features that are missing from the API request, such as the FICO score, are stored in the company’s internal database, we can use an enrichment to retrieve these features and pass them to the prediction endpoint. This way, the endpoint will have all the features needed for processing the request and return a valid response.
Deployment policy#
You can configure query enrichments in the Enrichment panel of the API Designer. In our credit card fraud example, we’ll enrich each query with a few additional features about our cardholders.
Enrichment data can either be bundled or referenced (for SQL data).
A … deployment policy |
Means that … |
---|---|
Bundled |
The contents of the lookup table are copied and deployed as part of the API service on the API node. This mode is generally preferred when the lookup table is fairly small. |
Referenced |
The data for the lookup table is not managed by the API node. When you export an API service from Dataiku, the service does not contain the data. It only contains a reference to the original dataset, such as a connection name and a table name. It’s only available for SQL data. |
Additional options#
Once the enrichment is configured, you can try running a few test queries that have missing features, so that these missing features can be retrieved through enrichment.
If you’ve selected the option to return post-query enrichment in the Advanced panel, you will see the results of the enrichment in the Details section of each query.
What’s next?#
To get hands-on practice on using endpoints and enrichments, follow Tutorial | Real-time API deployment.
See also
See the reference documentation for more information on Enriching prediction queries.