Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
YK3
Contributor
Contributor

Dynamic Schema/Type -table column name in original name

I created a job in which I have to read from a DB table and write into another DB table.

I have to do this operation for almost 20 tables. So I am using Dynamic Type to achieve this instead of defining each table schema manually. The problem with Dynamic Type is that it creates all column names in the Upper case. For eg

Original column name-

EmpName,DeptLocReg,JoinDate

 

Column name created by Dynamic Type-

EMPNAME,DEPTLOCREG,JOINDATE

 

Is there a way to get the same original column names ie in

camelcase(

EmpName,DeptLocReg,JoinDate )

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

For testing, add a tJavaRow before tDBOutput, and write the below Java code to print the column name to the console, to see whether it is the original column name read from Database.

 

code on tJavaRow:

Dynamic columns = input_row.columnName;

for (int i = 0; i < columns.getColumnCount(); i++)

{

DynamicMetadata columnMetadata = columns.getColumnMetadata(i);

String col_name=columnMetadata.getName();

System.out.println(col_name);

 

}

 

output_row.columnName=columns;

View solution in original post

6 Replies
Anonymous
Not applicable

Hi

Which DB type? Need to check if it is database convert the column name to uppercase or there is an option to do it on tDBOutput component, like tSnowflakeOutput.

0695b00000SsrizAAB.png 

Regards

Shong

YK3
Contributor
Contributor
Author

Hi @Shicong Hong​ 

DB type is Microsoft SQL Server.No there is no option in the DB output component to make column Upper case .

Anonymous
Not applicable

For testing, add a tJavaRow before tDBOutput, and write the below Java code to print the column name to the console, to see whether it is the original column name read from Database.

 

code on tJavaRow:

Dynamic columns = input_row.columnName;

for (int i = 0; i < columns.getColumnCount(); i++)

{

DynamicMetadata columnMetadata = columns.getColumnMetadata(i);

String col_name=columnMetadata.getName();

System.out.println(col_name);

 

}

 

output_row.columnName=columns;

YK3
Contributor
Contributor
Author

Hi @Shicong Hong​ 

Yes you are right..I tried the way you mentioned above and found that while reading column names from the database, the Column names are read in Upper Case.

 In Input DB, Also, I do not define the schema manually. There also I am using Dynamic Type for the schema. In My select query in DB Input, I am naming column names in camelcase.Snippet of my Job.

 

0695b00000SssIOAAZ.pngInput DB is Oracle. What could be the solution so that it reads the column name as it is what is in the select query?

 

 

 

YK3
Contributor
Contributor
Author

Hi @Shicong Hong​ 

I got the Solution.

I need to give the column names in Double quotes in the select statement

Thanks

Anonymous
Not applicable

Great, thanks for your feedback!