Wednesday, November 1, 2017

How to view TPT logs using tlogview

Usually the TPT logs are located at /opt/teradata/client/${version}/tbuild/logs
Go to the above location and run the following commad:
Where the job_name is the filename ending with *.out

tlogview –j <job_name> -f "*" –g

tlogview -j tptl_job1 -f "*" -g

Read more ...

Wednesday, May 10, 2017

DataStage Schema Generator SQL for Teradata DBMS

When working on a project, I had around 100 tables and was required to generate Datastage schema files for the DataStage stages, so I have come up with this SQL in Teradata to generate the schema:

 

SELECT   
DS
FROM   
(
SELECT   
columnid
,
CASE    WHEN f_row=1 THEN 'record' || '0D0A'XC || '{final_delim=end, delim=",", null_field='''', quote=double} ' || '0D0A'XC || '( ' ||
TRIM(columnname) || ': ' ||
CASE    WHEN Nullable='Y' THEN 'nullable '
ELSE    '' 
END   
||
CASE   
    WHEN    ColumnType='CV' THEN ' string[max=' || TRIM(ColumnLength) || '];'
    WHEN    ColumnType='CF' THEN ' string[' || TRIM(ColumnLength) || '];'
    WHEN    ColumnType='D' THEN ' decimal[' || TRIM(DecimalTotalDigits) || ',    ' || TRIM(DecimalFractionalDigits) || '];'
    WHEN    ColumnType='TS' THEN ' TIMESTAMP;'
END   
    WHEN    f_row<>1
    AND    l_row<>1 THEN
TRIM(columnname) || ': ' ||
CASE    WHEN Nullable='Y' THEN 'nullable '
ELSE    '' 
END   
||
CASE   
    WHEN    ColumnType='CV' THEN ' string[max=' || TRIM(ColumnLength) || '];'
    WHEN    ColumnType='CF' THEN ' string[' || TRIM(ColumnLength) || '];'
    WHEN    ColumnType='D' THEN ' decimal[' || TRIM(DecimalTotalDigits) || ',    ' || TRIM(DecimalFractionalDigits) || '];'
    WHEN    ColumnType='TS' THEN ' TIMESTAMP;'
END   
    WHEN    l_row=1 THEN
TRIM(columnname) || ': ' ||
CASE    WHEN Nullable='Y' THEN 'nullable '
ELSE    '' 
END   
||
CASE   
    WHEN    ColumnType='CV' THEN ' string[max=' || TRIM(ColumnLength) || '];'
    WHEN    ColumnType='CF' THEN ' string[' || TRIM(ColumnLength) || '];'
    WHEN    ColumnType='D' THEN ' decimal[' || TRIM(DecimalTotalDigits) || ',' || TRIM(DecimalFractionalDigits) || '];'
    WHEN    ColumnType='TS' THEN ' TIMESTAMP;'
END    || '0D'XC || ')'

END    AS ds
, ROW_NUMBER () OVER(PARTITION BY tablename ORDER    BY columnid)      AS f_row
, ROW_NUMBER () OVER(PARTITION BY tablename ORDER    BY columnid DESC)   AS l_row
FROM   
dbc.COLUMNS
WHERE   
databasename='${databasename}'
    AND   
tablename='${tablename}'

) Q1
ORDER    BY columnid
;

 

While searching I came acroos this post, which has more detail on how to automate in DataStage. Thanks Jing. Read more ...

Enable root account on AWS instance

After logging to the AWS instance, sudo as root and edit /etc/ssh/sshd_config and change the following:

PermitRootLogin yes     

PasswordAuthentication yes

- And reload the sshd service

   

service sshd reload

- And assign the password to root

   

passwd root

Read more ...

Setting up HomeBridge on Raspberry Pi 2

Download the latest jessie package

Read more ...