compiler

Compile resolved query to SQL

Changed on

Compile a resolved query to SQL.

Takes a previously resolved query and generates the final SQL statement for the target dialect.

RLS: Filtered to current client (ClientRLSDB).

post/api/v1/compiler/compile

Request

  • Base URL
    https://api.kater.ai
  • Auth
    • HTTP bearer
    • or API key in header X-API-Key

Query parameters

sourcestring nullable

Headers

X-Kater-CLI-IDstring nullable

Request body

connection_idstring uuid required

Connection to compile against

tenant_keystring required

Tenant key for multi-tenant compilation. Use 'kater_global_tenant' for no-tenancy clients or to bypass tenant isolation. For database tenancy, maps to the tenant's database. For row tenancy, used as the row-level filter value.

Example request

{
  "resolved_query": {
    "chart_hints": [
      {
        "config": {
          "color_by": "ref(created_date)",
          "size": "ref(created_date)",
          "stack_by": "ref(created_date)",
          "x_axis": "ref(created_date)",
          "y_axis": "ref(created_date)"
        }
      }
    ],
    "filters": [
      {
        "exists": {
          "from": "ref(dim_customer.sale_price)"
        },
        "not_exists": {
          "from": "ref(dim_customer.sale_price)"
        }
      }
    ],
    "resolved_chart": {
      "config": {
        "color_by": "ref(created_date)",
        "size": "ref(created_date)",
        "stack_by": "ref(created_date)",
        "x_axis": "ref(created_date)",
        "y_axis": "ref(created_date)"
      }
    },
    "resolved_variables": [
      {
        "allowed_values": {
          "from_column": "ref(dim_customer.sale_price)"
        }
      }
    ],
    "select_from": [
      {
        "ref": "ref(dim_customer.sale_price)"
      }
    ],
    "source_query": "ref(dim_customer.sale_price)",
    "topic": "ref(dim_customer.sale_price)"
  }
}

Response

Successful Response

dialectstring required

SQL dialect used (e.g. 'snowflake')

request_idstring nullable

Write-back request ID. Non-null when files were dispatched to CLI via WebSocket.

sqlstring nullable

Generated SQL statement

successboolean required

Whether compilation succeeded

Changes

    • breaking

      the request property became required

    • breaking

      request property list-of-types was narrowed by removing types null from media type application/json

    • breaking

      added the new required request property ////

    • breaking

      removed from the /// request property anyOf list

    • breaking

      removed the enum value area_chart of the request property ///

    • breaking

      removed the enum value bar_chart of the request property ///

    • breaking

      removed the enum value card_grid of the request property ///

    • breaking

      removed the enum value data_table of the request property ///

    • breaking

      removed the enum value donut_chart of the request property ///

    • breaking

      removed the enum value gauge of the request property ///

    • breaking

      removed the enum value heatmap of the request property ///

    • breaking

      removed the enum value image of the request property ///

    • breaking

      removed the enum value key_value_list of the request property ///

    • breaking

      removed the enum value kpi_card of the request property ///

    • breaking

      removed the enum value line_chart of the request property ///

    • breaking

      removed the enum value pie_chart of the request property ///

    • breaking

      removed the enum value scatter_chart of the request property ///

    • breaking

      removed the enum value single_value of the request property /

    • breaking

      removed the enum value stat_cards of the request property ///

    • breaking

      removed the enum value static of the request property /

    • breaking

      removed the enum value styled_table of the request property ///

    • breaking

      removed the enum value text of the request property ///

    • breaking

      response property errors list-of-types was widened by adding types array to media type application/json of response 400

    • breaking

      response property errors list-of-types was widened by adding types array to media type application/json of response 401

    • breaking

      response property errors list-of-types was widened by adding types array to media type application/json of response 403

    • breaking

      response property errors list-of-types was widened by adding types array to media type application/json of response 404

    • breaking

      response property errors list-of-types was widened by adding types array to media type application/json of response 422

    • breaking

      response property errors list-of-types was widened by adding types array to media type application/json of response 500

    • warning

      removed the request property /

    • info

      added the new optional request property ////

    • info

      added to the /// request property anyOf list

    • info

      added the new DATE[] enum value to the request property ////

    • info

      added the new FLOAT[] enum value to the request property ////

    • info

      added the new INT[] enum value to the request property ////

    • info

      added the new STRING[] enum value to the request property ////

    • info

      added the new axis_metric_by_dimension enum value to the request property ///

    • info

      added the new axis_metric_by_dimensiondate enum value to the request property ///

    • info

      added the new axis_metric_by_dimensiondate_sliced_by_dimension enum value to the request property ///

    • info

      added the new axis_scatter_plot enum value to the request property ///

    • info

      added the new dimension_date enum value to the request property //////

    • info

      added the new funnel enum value to the request property /

    • info

      added the new funnel_funnel_chart enum value to the request property ///

    • info

      added the new heatmap_heatmap enum value to the request property ///

    • info

      added the new image enum value to the request property /

    • info

      added the new image_image_grid enum value to the request property ///

    • info

      added the new image_single_image enum value to the request property ///

    • info

      added the new kpi_card enum value to the request property /

    • info

      added the new kpi_measure_with_dimension_expression enum value to the request property ///

    • info

      added the new kpi_measure_with_secondary_metric enum value to the request property ///

    • info

      added the new kpi_single_measure_compared_to_prev_period_sparkline enum value to the request property ///

    • info

      added the new kpi_single_value enum value to the request property ///

    • info

      added the new pie_pie_chart enum value to the request property ///

    • info

      added the new table_data_table enum value to the request property ///

    • info

      added the new table_fancy_subtotal_table enum value to the request property ///

    • info

      added the new table_key_value_list enum value to the request property ///

    • info

      added the new table_styled_table enum value to the request property ///

    • info

      added the new text enum value to the request property /

    • info

      added the new text_data_readout_with_sparkline enum value to the request property ///

    • info

      added the new text_narrative_text enum value to the request property ///

    • info

      request property //// list-of-types was widened by adding types array to media type application/json

    • info

      request property //// list-of-types was widened by adding types array to media type application/json

    • info

      added the optional property to the response with the status