SQL
Get SQL Schema
Describe a database’s tables, fields, and link tables for composing SQL queries.
GET
/
bases
/
{databaseId}
/
sql
/
schema
Get SQL schema
curl --request GET \
--url https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema \
--header 'Authorization: Bearer <token>'import requests
url = "https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"tables": [
{
"name": "<string>",
"primaryFieldName": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"postgresType": "<string>",
"linksTo": "<string>",
"options": [
{
"value": "<string>",
"label": "<string>",
"color": "<string>"
}
]
}
]
}
],
"linkTables": [
{
"name": "<string>",
"joins": [
"<string>"
],
"sourceTable": "<string>",
"targetTable": "<string>",
"sourceTableIdColumn": "<string>",
"targetTableIdColumn": "<string>"
}
]
}Returns the database schema (tables, their fields, and the link tables that connect them) using human-readable names. Use this to discover the exact table and field names to reference from Run SQL.
Names in the response match the human-readable names used in your SQL queries and the Zite SDK.
Query parameters
| Parameter | Type | Description |
|---|---|---|
tables | string[] | Optional whitelist of table names to include. Repeat the parameter for multiple tables (e.g. ?tables=Orders&tables=Customers) or pass a single comma-separated string. Omit to return all tables. |
includeFields | boolean | Whether to include field-level detail. Defaults to true. Set to false for a cheap overview of just table names. |
Link tables
linkTables describes the junction tables that connect two tables for many-to-many relationships. Each entry exposes the source and target tables along with the columns to join on, so you can traverse linked records in SQL.Query Parameters
⌘I
Get SQL schema
curl --request GET \
--url https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema \
--header 'Authorization: Bearer <token>'import requests
url = "https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://tables.zite.com/api/v1/bases/{databaseId}/sql/schema")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"tables": [
{
"name": "<string>",
"primaryFieldName": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"postgresType": "<string>",
"linksTo": "<string>",
"options": [
{
"value": "<string>",
"label": "<string>",
"color": "<string>"
}
]
}
]
}
],
"linkTables": [
{
"name": "<string>",
"joins": [
"<string>"
],
"sourceTable": "<string>",
"targetTable": "<string>",
"sourceTableIdColumn": "<string>",
"targetTableIdColumn": "<string>"
}
]
}