Query ID graph to find individual IDs appearing in multiple canonical ID groups. Use when debugging over-stitching by checking whether a single ID has been stitched to more than one canonical ID.
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Detect over-stitching by finding individual IDs that appear across multiple canonical ID groups.
The database name contains the parent segment ID and has this format cdp_audience_411671. This is where you can plug in the parent segment the user gives in the request.
The ID graph table is typically called ids_updated and is in the Parent Segment real time database. This table contains the canonical ID mappings created by RT 2.0's ID stitching process.
The ids_updated table has the following key columns:
The main query to identify individual IDs mapping to multiple canonical IDs:
WITH flattened_ids AS (
SELECT
canonical_id,
individual_id
FROM cdp_audience_<parent_segment_id>.ids_updated
CROSS JOIN UNNEST(id_set) AS t(individual_id)
WHERE td_interval(time, '-7d') -- Avoid full table scan
),
id_counts AS (
SELECT
individual_id,
COUNT(DISTINCT canonical_id) as canonical_count,
ARRAY_AGG(DISTINCT canonical_id) as canonical_ids
FROM flattened_ids
GROUP BY individual_id
)
SELECT
individual_id,
canonical_count,
canonical_ids
FROM id_counts
WHERE canonical_count > 1 -- Only show over-stitching cases
ORDER BY canonical_count DESC, individual_id
LIMIT 100;treasure-data/td-skills
d0e1a9d
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.