Hello everybody!
I have a requirement to pivot a table to send it as a .csv.
My main goal is to transform the data row of a column into several columns, which one as date. The extraction will be send every monday, containing data from the last 7 days. Because the date changes, I would have to dynamically set the values for the date to become automatic.
My Transformation is this way:
Screenshot from 2017-01-24 10-26-41.jpg
My Row denormaliser is like this:
row denormaliser.jpg
My query is returning something like this:
parceiro inserted_date servico valor type
xyz 2017-01-19 abc 9840 novos
xyz 2017-01-19 abc 1017 cancelados
xyz 2017-01-19 abcd 305074 base
xyz 2017-01-19 abcd 0 novos
xyz 2017-01-19 xpto 14 cancelados
xyz 2017-01-19 xpto 10457 base
xyz 2017-01-20 xpto 3100 novos
xyz 2017-01-20 qwerty 1378 cancelados
xyz 2017-01-20 qwerty 441693 base
xyz 2017-01-20 qwerty 9 novos
And the step Row denormaliser is returning what I need:
parceiro servico type 2017-01-17 2017-01-18 2017-01-19 2017-01-20 2017-01-21 2017-01-22 2017-01-23
xyz xpto base 46562 52744 58156 62053 64837 64682 60957
xyz xpto cancelados 609 730 771 527 405 260 548
xyz xpto novos 5262 6790 6140 4667 3310 250 3935
xyz abc base 10489 10470 10457 10443 10428 10413 9181
xyz abc cancelados 19 13 14 15 16 11 13
xyz abc novos 0 0 0 0 0 1 0
xyz abcd base 28605 28545 28503 28458 28413 28379 25181
xyz abcd cancelados 60 42 46 45 36 17 53
xyz abcd novos 2 0 0 1 0 2 1
xyz qwerty base 290215 296255 305074 306607 307360 306720 270586
My problem is that I need to change every week the fields Target fieldname and Key Value in Row Denormaliser step. Since I can not use variables, and I can only use one value in with step ETL Metadata Injection, what can I do?
I am using PDI 6.1 with Linux, and the database that I am conecting is Amazon Redshift, and it does not have pivot function like SQL Server or Postgres.
Thanks everyone!
I have a requirement to pivot a table to send it as a .csv.
My main goal is to transform the data row of a column into several columns, which one as date. The extraction will be send every monday, containing data from the last 7 days. Because the date changes, I would have to dynamically set the values for the date to become automatic.
My Transformation is this way:
Screenshot from 2017-01-24 10-26-41.jpg
My Row denormaliser is like this:
row denormaliser.jpg
My query is returning something like this:
parceiro inserted_date servico valor type
xyz 2017-01-19 abc 9840 novos
xyz 2017-01-19 abc 1017 cancelados
xyz 2017-01-19 abcd 305074 base
xyz 2017-01-19 abcd 0 novos
xyz 2017-01-19 xpto 14 cancelados
xyz 2017-01-19 xpto 10457 base
xyz 2017-01-20 xpto 3100 novos
xyz 2017-01-20 qwerty 1378 cancelados
xyz 2017-01-20 qwerty 441693 base
xyz 2017-01-20 qwerty 9 novos
And the step Row denormaliser is returning what I need:
parceiro servico type 2017-01-17 2017-01-18 2017-01-19 2017-01-20 2017-01-21 2017-01-22 2017-01-23
xyz xpto base 46562 52744 58156 62053 64837 64682 60957
xyz xpto cancelados 609 730 771 527 405 260 548
xyz xpto novos 5262 6790 6140 4667 3310 250 3935
xyz abc base 10489 10470 10457 10443 10428 10413 9181
xyz abc cancelados 19 13 14 15 16 11 13
xyz abc novos 0 0 0 0 0 1 0
xyz abcd base 28605 28545 28503 28458 28413 28379 25181
xyz abcd cancelados 60 42 46 45 36 17 53
xyz abcd novos 2 0 0 1 0 2 1
xyz qwerty base 290215 296255 305074 306607 307360 306720 270586
My problem is that I need to change every week the fields Target fieldname and Key Value in Row Denormaliser step. Since I can not use variables, and I can only use one value in with step ETL Metadata Injection, what can I do?
I am using PDI 6.1 with Linux, and the database that I am conecting is Amazon Redshift, and it does not have pivot function like SQL Server or Postgres.
Thanks everyone!