Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I have a question for mapping load.
In mapping load you are supposed to use only 2 columns.
for example
If i use X table as mapping load only 2 columns are used.. but the actual X table contains more than 10 columns. how do I load the X table later after mapping load.
Can i use it as below
mapping load
X,
y
SQL Select * from X;
map:
Load
a,
b,
b
Apply map condition .....(...
SQL ..select condition/
After once above mapping is done. Can i call the orginal X table. How does the apply map behave.
X Table:
Load
X,
Y
..
,,
SQL select * from X;
MapTable:
mapping load
field1,
field2;
SQL Select * from X;
Table1:
Load
a,
b,
c,
ApplyMap('MapTable', ..............);.
SQL ..select condition;
After once above mapping is done. Can i call the orginal X table. How does the apply map behave.
You can load another time (many times) the X table. The mapping table is only used in the ApplyMap (bold) not in the below statement, because there isn't an ApplyMap.
In the "mapping load" you must use 2 fields.
In the normal (no mapping) load you can use as many fields you want.
Table2:
Load
field1,
field2,
field3,
...... ;
SQL select * from X;
Hi , So how could I do an apply map with different column names
for ex : can I do as below to make an alias and further apply map
MapTable:
mapping load
name as a,
address;
SQL Select * from X;
Table1:
Load
a,
b,
c,
ApplyMap('MapTable',a ..............);.
SQL ..select condition;
You can create one mapping table per field using resident loads from table X:
X:
SELECT * FROM X.....
Map1:
Mapping Load key, value1 Resident X;
Map2:
Mapping Load key, value2 Resident X;
...
And then apply each map in the main load:
LOAD
....
ApplyMap('Map1', key) As Value1,
ApplyMap('Map2', key) As Value2,
...
In this case it may be better to perform a join, as long as the key value is unique in table X and you don't need default values for the 'missing' values after the join.
.
Test both options to determine the best performance.
Hi Jonanthan,
My scenario looks like this I need to RELATE 3 tables. but it is going to loop.
Table 1:
MAPPING LOAD DISTINCT
Prod Id,
Cust Id
from CustItem Table;
Map:
Load
Id,
few columns....
ApplyMap('Table1', Id) as Cust Id ---- So here I want to map Id and ProdId together
from Product Table
Now I want to take the output of apply map -- I,e Cust Id to join as automatically based on column as below
Load
Id as Cust Id
few columns
...
..
from Customer Table.