0

I havea long script that goes through lots of calculations which I would like to trace columns where they originate from. For example column "identifier" and "concat_var" in the table z in the example below. Can I do this "automatically" somehow and presented in graph?

-- borrowed from https://stackoverflow.com/q/7745609/808921

CREATE TABLE IF NOT EXISTS `docs` (
  `id` int(6) unsigned NOT NULL,
  `rev` int(3) unsigned NOT NULL,
  `content` varchar(200) NOT NULL,
  PRIMARY KEY (`id`,`rev`)
) DEFAULT CHARSET=utf8;
INSERT INTO `docs` (`id`, `rev`, `content`) VALUES
  ('1', '1', 'The earth is flat'),
  ('2', '1', 'One hundred angels can dance on the head of a pin'),
  ('1', '2', 'The earth is flat and rests on a bull\'s horn'),
  ('1', '3', 'The earth is like a ball.');

CREATE TABLE x (
  SELECT * FROM docs WHERE rev = 1);
  
  CREATE TABLE y (
    SELECT * FROM docs WHERE rev != 1);

CREATE TABLE z (
  SELECT
    CONCAT(a.content, ' - ', b.content) AS concat_var
  , a.id AS identifier
  FROM
    x AS a
   INNER JOIN
     y AS b
    ON
      a.id = b.id);
MLEN
  • 2,162
  • 2
  • 20
  • 36

1 Answers1

0

There are few products on the market that do this: https://dbmstools.com/categories/data-dictionary-tools/redshift

user3112728
  • 395
  • 1
  • 12