Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get alias applied when gessing shema from a query?

Hi,
I am new to this forum and quite new to Talend also. I am using it as an ETL to populate my datawarehouse and perform some audit stuff.
In order to retrieve data from a MySQL source, I wrote a query using some alias to get proper naming but Talend does not take them into account when gessing the schema.
Let take a basic example:
If I use the following query
"SELECT
s1.code as source1_code,
s2.code as source2_code
FROM
Source1 s1 INNER JOIN Source2 s2 ON s1.source2_id=s2.id"
Talend gess code and code1 instead of source1_code and source2_code.
Could anyone help?
Thanks
Labels (2)
2 Replies
Anonymous
Not applicable
Author

This is not a problem caused by Talend. This is caused by the database driver and its usage of database metadata.
I have a very similar problem with DB2.
A way to forth the driver to use the alias is to fake a funktion:
in case of a number field (s1.code+0) as source1_code
in case of a character field (s1.code||'') as source1_code
This way you will probably get the alias name instead of the original column name.
Anonymous
Not applicable
Author

Ok thanks
I confirm the way you fake function works good to get the alias name.
But I think I will prefer renaming the column names by myself before storing them into generic schemas. Maybe it is a more proper way.