ThinkWithPrompt by SynotticThinkWithPrompt

Trace data lineage across SQL scripts and stored procedures

Map where each table's data comes from and goes to, so you can see what breaks before you change a table.

Data & AnalysisFew-ShotStandardData & AnalyticsWritingCodingAnalyze

The prompt

Help me trace data lineage in my database code. Database platform: [e.g. SQL Server, Oracle, Snowflake, PostgreSQL] Code: [PASTE SQL scripts, stored procedures, views, or ETL steps - mask credentials and connection strings] Table or column I care about: [NAME, or "all"] Why I'm asking: [e.g. "planning to change a column type", "debugging a wrong number in a report", "documenting for an audit"] Analyze the code and give me: 1. A lineage table: source object, target object, operation (INSERT, UPDATE, MERGE, SELECT INTO, view, etc.), the script or procedure where it happens, and the key columns involved. 2. Upstream and downstream chains for my table or column, written as simple arrows (e.g. staging.orders -> dbo.orders -> vw_sales -> report). 3. Column-level transformations: renames, calculations, filters, joins, and type conversions that change the data on the way. 4. Impact assessment for my planned change: every object likely to break or produce different results, ranked by risk. 5. Gaps: dynamic SQL, temp tables, linked servers, external jobs, or objects referenced but not included, where lineage cannot be confirmed from the code I gave you. 6. A Mermaid flowchart of the lineage I can paste into documentation. Only report dependencies you can see in the code. Mark anything inferred as [INFERRED] and list what extra code or metadata (e.g. system dependency views, job schedules) would confirm it.

Highlighted [brackets] are blanks to replace with your own details.

Fill in the blanks and use this promptMore Data & Analysis prompts

What to fill in

  • e.g. SQL Server, Oracle, Snowflake, PostgreSQL
  • NAME, or "all"
  • INFERRED

How this prompt is built

This prompt follows the Few-Shot structure (Few-shot prompting). A few-shot prompt includes one or more worked examples of the input and the output you want, so the model can copy the pattern instead of guessing it.

Related prompts

Find more prompts like this