M
M
makondo2021-12-15 12:12:21
SQL
makondo, 2021-12-15 12:12:21

How to track field conversions in a forked chain of SQL queries?

There are a large number of tables and a large number of SQL inserts from one to another of the INSERT as SELECT type.
There are no asterisks in SELECTs, all fields are listed explicitly, but views are used, the code of which is also available.
Queries have multiple nested subqueries, INNER/LEFT JOINs, CROSS JOIN, WITH, UNION ALL, but no correlated subqueries with EXISTS\IN.

Transformations, data transfer form a complex tree, where fields from many enter one table, which in turn are filled with data from others. etc.

I would like to write a tool that would keep track for a particular field in the final table, which fields are written to it from direct source tables, and so on, to the very beginning. That is, it is necessary to carry out recursive parsing or parsing of all queries that pour data into the table and track field conversions, and at the output get a tree for one final field.

I am sure that the task has been faced many times before by others and there are tools, but I didn’t manage to google it right away.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan GiBSON, 2015-07-09
@Platton

Well, then something like this
Well, or even simpler
It all depends on the needs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question