Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 )
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;
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.
Regards
Shong
Hi @Shicong Hong
DB type is Microsoft SQL Server.No there is no option in the DB output component to make column Upper case .
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;
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.
Input DB is Oracle. What could be the solution so that it reads the column name as it is what is in the select query?
Hi @Shicong Hong
I got the Solution.
I need to give the column names in Double quotes in the select statement
Thanks
Great, thanks for your feedback!