curl --request GET \
--url https://developer.synq.io/api/sql-insights/v1/join-patterns \
--header 'Authorization: Bearer <token>'import requests
url = "https://developer.synq.io/api/sql-insights/v1/join-patterns"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://developer.synq.io/api/sql-insights/v1/join-patterns', 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://developer.synq.io/api/sql-insights/v1/join-patterns",
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://developer.synq.io/api/sql-insights/v1/join-patterns"
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://developer.synq.io/api/sql-insights/v1/join-patterns")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer.synq.io/api/sql-insights/v1/join-patterns")
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{
"patterns": [
{
"key": [
{
"column": {
"entityId": "<string>",
"column": "<string>",
"derivation": "JOIN_SIDE_DERIVATION_UNSPECIFIED",
"expression": "<string>"
},
"other": {
"entityId": "<string>",
"column": "<string>",
"derivation": "JOIN_SIDE_DERIVATION_UNSPECIFIED",
"expression": "<string>"
},
"kind": "JOIN_KIND_UNSPECIFIED",
"operator": "JOIN_OPERATOR_UNSPECIFIED",
"leads": true
}
],
"filters": [
"<string>"
],
"evidenceKinds": [
"JOIN_EVIDENCE_KIND_UNSPECIFIED"
],
"sources": [
{
"entityId": "<string>",
"statementIndex": 123,
"joinIndex": 123
}
],
"queryLog": {
"queries": 123,
"distinctLogins": 123,
"firstHour": "2023-01-15T01:30:15.01Z",
"lastHour": "2023-01-15T01:30:15.01Z",
"issuers": [
{
"platform": "<string>",
"entityId": "<string>",
"queries": 123,
"distinctLogins": 123
}
],
"sampleQueryId": "<string>"
}
}
],
"queryLogCoveredHours": 123
}ListJoinPatterns
ListJoinPatterns lists how other SQL joins a table, or one of its columns:
every join key that the SQL of a table, view or model in the workspace
uses to join the requested entity, read from the requested entity’s side,
and which SQL makes it. It is the reverse of BatchSqlDetails joins, which
say how building one entity joins others: here the requested entity is the
one being joined.
The requested entity is taken together with every entity that is the same object, like a dbt model, the table it builds and that table in a catalog, so asking about any of them returns the joins on all of them.
curl --request GET \
--url https://developer.synq.io/api/sql-insights/v1/join-patterns \
--header 'Authorization: Bearer <token>'import requests
url = "https://developer.synq.io/api/sql-insights/v1/join-patterns"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://developer.synq.io/api/sql-insights/v1/join-patterns', 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://developer.synq.io/api/sql-insights/v1/join-patterns",
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://developer.synq.io/api/sql-insights/v1/join-patterns"
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://developer.synq.io/api/sql-insights/v1/join-patterns")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer.synq.io/api/sql-insights/v1/join-patterns")
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{
"patterns": [
{
"key": [
{
"column": {
"entityId": "<string>",
"column": "<string>",
"derivation": "JOIN_SIDE_DERIVATION_UNSPECIFIED",
"expression": "<string>"
},
"other": {
"entityId": "<string>",
"column": "<string>",
"derivation": "JOIN_SIDE_DERIVATION_UNSPECIFIED",
"expression": "<string>"
},
"kind": "JOIN_KIND_UNSPECIFIED",
"operator": "JOIN_OPERATOR_UNSPECIFIED",
"leads": true
}
],
"filters": [
"<string>"
],
"evidenceKinds": [
"JOIN_EVIDENCE_KIND_UNSPECIFIED"
],
"sources": [
{
"entityId": "<string>",
"statementIndex": 123,
"joinIndex": 123
}
],
"queryLog": {
"queries": 123,
"distinctLogins": 123,
"firstHour": "2023-01-15T01:30:15.01Z",
"lastHour": "2023-01-15T01:30:15.01Z",
"issuers": [
{
"platform": "<string>",
"entityId": "<string>",
"queries": 123,
"distinctLogins": 123
}
],
"sampleQueryId": "<string>"
}
}
],
"queryLogCoveredHours": 123
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
The synq path of the table, view or model to list the join patterns of,
as the paths of BatchSqlDetailsRequest take it.
1 - 4096Set to return only the patterns whose key compares this column of the
entity, like customer_id. Matched case-insensitively. Leave empty for
every column.
4096Set to return only how the entity is joined with this other entity, which
answers "how do I join these two tables". A key that also compares a third
table keeps only its comparisons with this one. Like entity_id, it
matches every entity that is the same object. Leave empty for joins with
any entity.
4096Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.
A pattern seen only in the query history is listed when it reaches any of these thresholds that is set. 0 sets none, and with none set every pattern is listed. A pattern that a SQL definition makes is always listed.
Set to return only the patterns whose every side is a plain column, with
no expression around it, like lower(email) or a cast.
Response
Success
ListJoinPatternsResponse lists the join patterns of the requested entity.
The join patterns. Those that a SQL definition makes come first, then those of the query history only, by distinct logins, the last hour seen and queries. Empty when no SQL in the workspace joins the entity, or none was parsed yet.
Show child attributes
Show child attributes
How many hours of the query_log window the query history covered in
full. 0 with no QUERY_LOG pattern means that no query history was read
for the window, not that no query made a join.