How can I get a table to 2NF in Talend?
Currently I have:
Marc Mayr 12/12/1980 Someitem
Marc Mayr 12/12/1980 Somethingelse
Steven Ming 08/09/1981 Completelydifferent
So I want to split person and item data into two separate tables.
How can this be done using Talend? (Remark: I don't have a primary key yet, but I can use a combination of name and birthday - already checked for distinct values.)
Thanks in advance!
You can use something like this:
tFileinput -> First_Name,Second_Name,Year -> tMySQLOutput (persons) (set the table to have an ID with auto increment as the primary key)
tFileinput ->
tMap -> Item
tMySQLInput(persons) ->
So basically there are 2 different step:
Step1: create the persons table
Step2: map the persons the the inputfile and populate the orders table.
This can be done via SQL as well.
Related
Tough to come up with a reasonable title for this one!
I am copying data from a source table (let's call it Books) that has an enum column (Category):
ID Title Category
----------------------------
1 Test1 Education
2 Blah Leisure
3 Brown fox Leisure
...
So in this example, there are two enum members, Education and Leisure.
The sink is SQL, and I'm getting the distinct set of enum values and putting them in a lookup table (Categories in this example). The Books table in the sink should have a foreign key column called CategoryId that refers to the PK in the Categories lookup table.
So I need to figure out how to use the text from the Category column to get the ID from the lookup table and use it as the value in the Books.CategoryId column. Anyone know how to do that? I'm just getting my feet wet with ADF so I'll really appreciate any assistance.
Thanks!
Add a data flow to your pipeline and that will allow you to build a pattern to dedupe and value lookups. If you need some guidance on building data flows, use our YouTube channel of helper videos: https://aka.ms/dataflowvids
I have to reference information of a table using the PK from another table. For that I have to see if the information matches in a third table.
To better explain, I show you the screenshots the SELECT from the tables I need to use or change.
In the next two screenshot of tables, I have an Address table that contains information about differentes addresses and an "addressid" PK. The next table, is a Company table that provides information about differentes companies. These companies need to have two FKs to the Address table in the two different columns that are empty.
So, I have a table with a lot of mixed information, including the addresses combined with the companies.
Using this "import" tables, I have to set the empty FK on Company table related to the PKs of Address table.
I have tried doing an UPDATE function but I don't really know how to write the conditions to use this "import" table to relate the other two tables.
Thanks on advance.
In the IMPORT table I have all the info in Company table and Address table, but mixed, with other unused information. So, I have for each row in Company, look at the Company name, search it on the import table, look in the same row what is the address, search it on the Address table and put the correspondent PK on the Company table... Example: COMPANY - Google IMPORT - Google California ADDRESS - Californa id1 Go to COMPANY - Google (add id1 on column address)... Sorry if I explain it not so good.
Something like this might work for the shipping address:
update company c
set ordership_address = (select addressid
from address a
inner join import i
on a.addressname = i.ordershipadress
and a.postalcode = i.ordershippostalcode
-- and other criteria ?
where i.companyname = c.companyname)
Don't know how your address.cityid maps to something so leave that one for you.
For example I have a table called product_list, which holds a list of products.
If I insert 1 row of data into product_list, part of the data (such as product_id & product name) should also be inserted in another table like product_price which holds the price for all products (new products would have 0 or NULL values for their price).
My question here is the method in approaching this. What is the proper way to do this?
My current ideas:
1 - Using a trigger to insert into the other tables like product_price,etc whenever I insert a product data into product_list
2 - Using a function (stored procedure) like product_add to add a new product into each tables.
Which method is better? Or if there a better suggestion, then I'd like to know about it. Thanks in advance.
In my Excel Sheet i have the product name ,i need to get primary key of the product from product master table and the same should be insert into transaction table , how i can perform this process by using talend?
Check out tmap component. The tmap allows you to have the main data flow and perform lookups on that data and retrieve data from the lookups.
All, I need to get a table value based on the primary key from it table then I used that on the other table. I can ilustrate my question like this:
table a
id_a
att_a1
att_a2
att_a3
att_a4
att_a5
table b (dummy table)
id_a
id_c
percentage_a1
percentage_a2
table c (here i need to calculate my result)
id_c
att_c1 = att_a1*percentage_a1
att_c2 = att_a2*percentage_a2
att_c3 = att_c2+att_a4
How could I do that in Yii?
Any response pls
Thx, my regards
There are a couple of things that you need to do. You need to establish a many to many relationship between the two tables inside the class of the middle table. You need to set has settings for each of the outer tables.
Follow these instructions:
http://www.yiiframework.com/doc/guide/1.1/en/database.arr