Skip to main content

Views

A view is a transformed view of one or more tables. Views are created by transforms, which are either SQL queries or LLM prompts.

SQL view

An SQL view is created by running an SQL query against one or more tables.

You can use them to:

  • Filter or aggregate source tables
  • Join multiple datasets
  • Create derived features from existing columns
  • Reshape data structures such as JSON

Example: Join two tables

import requests
import json

url = "https://api.shaped.ai/v1/transforms"

payload = json.dumps({
"name": "hm_items_with_descriptions",
"transform_type": "SQL",
"sql_transform_type": "VIEW",
"sql_query": "select * from hm_items items left join hm_items_with_descriptions ai_items on ai_items.item_id = items.item_id"
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'LmBjMxgOtV1js4Zf3jiqw1VhnWfa7I1u9jBLSJeg'
}

response = requests.request("POST", url, headers=headers, data=payload)

AI view

An AI view is created by running an LLM prompt against the records in a dataset. They take columns from a source dataset, apply an LLM with a prompt, and output new columns with enriched information.

Use them specifically to enrich data that will power semantic search.

Learn more in our AI enrichment guide - Enrich your tables with AI