Mapping extract column names and values

Six Stars AB
Six Stars

Mapping extract column names and values

Hi,

 

I have a database table that contains a number of columns that I ned to extract to a csv file. During the extract process I need to dynamically alter some of the column names and values based on a mapping table that I've built. 

 

Example input (database)

col1 col2 col3

abc
abd
aec

 

And after being mapped the output should look something like

ID Name col3

abarc
abard
aeggc

 

I'm using Talent open studio so the dynamic schema components are not available to me . Any suggestions on how I can achieve this? I have done something similar previously however that data was pivoted so that the column names and values were obtained in the data and I could use a tmap to do the mapping

e.g

ID Attribute Value

acol2b
acol3d

 

 

Forteen Stars

Re: Mapping extract column names and values

connect to tMap

- main table with main connection

- lookup table with lookup

use LEFT join by to columns:

- col1 == id

- col3 == value

 

map to output

- col1, col3 from main table

- attribute from lookup table

-----------
Six Stars AB
Six Stars

Re: Mapping extract column names and values

Hi @vapukov thanks for the quick reply. The problem is I need to map the column names dynamically as well, not just the values. My mapping table specifies old and new names for columns so col1 = ID etc. I don't think I can achieve that through a tmap

Forteen Stars

Re: Mapping extract column names and values

yes, you can not ...

 

first of all -dynamic schema - do not help you as well Smiley Happy

 

but, you could:

- redesign schema for more appropriate (if you can)

- use sql for achive what you need - both tables in database (even if it different databases - first step land data to the same database staging table), then use SQL for return mapped data (tSQLinput support any query, bot only table)

-----------
Six Stars AB
Six Stars

Re: Mapping extract column names and values

Thanks @vapukov Yes, I'm thinking I need to do this in the db and then Talend can handle the results. I guess I posted to see if there were any components to do this in Talend 

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download