Skip to main content
You can call a published business rule as a SQL function in Trino or Spark. This lets a query use a rule’s decision on every row without a separate call to the API.

Prerequisites

Before starting this task, ensure you have the following:

Steps

Perform these steps to call a published rule from SQL:
  1. Open a SQL editor that connects to Trino or Spark, such as SQL Lab in Superset. To open Superset, refer to Launch Superset.
  2. Optional: To see which workspaces and rules you can call, run the following commands in Trino.
  3. Call a rule as a function by running a query like the following:
    Replace the placeholders with the following values:
    • <workspace-name>: The name of a workspace.
    • <function-name>: The key of a rule, which you entered when you created it.
    • <arguments>: The values that a rule needs, separated by commas.

Additional resources

To publish a version, refer to Publish a version.