Suresh - ELMO - What would be the best way to f...
# dev-help
s
What would be the best way to find out all the model columns that have dependent objects - liveboard, answer? We are trying to locate all answers/liveboards that uses particular column so we can update/delete accordingly. Right now, all I could be able to get is list of liveboard, answer that is dependent on entire model which produces too much of noise.
a
message has been deleted
s
Solution: Use
POST /api/rest/2.0/metadata/search
with
metadata.type = "LOGICAL_COLUMN"
and
include_dependent_objects = true
. That is the most targeted way to get dependents for a specific column (instead of the full worksheet/model), then filter dependents to
LIVEBOARD
and
ANSWER
. ```js // single-file JavaScript example (Node 18+) // npm i node-fetch import fetch from "node-fetch"; const TS_HOST = "https://YOUR_TS_CLUSTER"; const TOKEN = "YOUR_BEARER_TOKEN"; // or session cookie auth const COLUMN_IDENTIFIER = "YOUR_COLUMN_GUID_OR_NAME"; // prefer GUID const COLUMN_TYPE = "LOGICAL_COLUMN"; async function findColumnDependents() { const body = { metadata: [ { identifier: COLUMN_IDENTIFIER, type: COLUMN_TYPE } ], include_dependent_objects: true, dependent_objects_record_size: 1000, // increase if needed include_headers: true, record_size: 10, record_offset: 0 }; const resp = await fetch(
${TS_HOST}/api/rest/2.0/metadata/search
, { method: "POST", headers: { "Content-Type": "application/json", Authorization:
Bearer ${TOKEN}
}, body: JSON.stringify(body) }); if (!resp.ok) { throw new Error(
metadata/search failed: ${resp.status} ${await resp.text()}
); } const data = await resp.json(); // Response shape for dependent_objects may vary by version; // normalize by walking all values and selecting LIVEBOARD/ANSWER. const dependents = []; for (const item of data) { const dep = item.dependent_objects || {}; const candidates = Array.isArray(dep) ? dep : Object.values(dep).flatMap(v => (Array.isArray(v) ? v : [v])); for (const d of candidates) { const t = d?.metadata_type || d?.type; if (t === "LIVEBOARD" || t === "ANSWER") { dependents.push({ id: d?.metadata_id || d?.id, name: d?.metadata_name || d?.name, type: t }); } } }
console.table(dependents); } findColumnDependents().catch(console.error); ``` If you only have a worksheet/model today, do this in 2 phases to reduce noise: 1. Get worksheet columns (
LOGICAL_COLUMN
) for that worksheet. 2. For each target column, call the same
metadata/search
with
include_dependent_objects=true
. --- Suggestions: - Use column GUIDs instead of names to avoid ambiguity. - Set
dependent_objects_record_size
high enough; otherwise you may think some dependents are missing. - Permissions matter: non-admin users only see objects they can access. - I could not find a separate dedicated “column lineage/dependents endpoint” in the official REST reference;
metadata/search
with
LOGICAL_COLUMN
+
include_dependent_objects
is the documented route. --- Docs: - REST API v2
metadata/search
(supports
LOGICAL_COLUMN
and
include_dependent_objects
) - REST API SDK (TypeScript):
@thoughtspot/rest-api-sdk
- REST API playground:
try-everywhere.thoughtspot.cloud
(v2 playground)
y
@User this looks good?