Wednesday, 18 January 2023

List views in postgresql

SELECT 

table_name 

FROM INFORMATION_SCHEMA.views 

WHERE 

table_schema = ANY (current_schemas(false)) 

ORDER BY 1

Kill job in Linux/Ubuntu

To list the running jobs,

ps -ef|grep java


To kill the job,

ill -9 pid


To kill the application by drag & drop

xkill

Sample shell script - To call the pentaho job

 #!/bin/bash -l

sh /home/abc/data-integration/kitchen.sh -file="/home/abc/etl/j_dataload.kjb" –level:Basic -logfile:/home/abc/etl/Logfiles/j_dataload_$(date +"%Y%m%d_%H%M%s").log

sh /home/abc/data-integration/kitchen.sh -file="/home/abc/etl/j_logfile_archive.kjb" –level:Basic -logfile:/home/abc/etl/Logfiles/j_logfile_archive_$(date +"%Y%m%d_%H%M%s").log


CRON Schedule

 Sample cron schedule,


0 14 * * * /home/abc/etl/ExecutJob.sh

Tuesday, 3 January 2023

Postgresql - Get the last 'X' months

To get the last 'x' months from the current date,

Method 1:

SELECT date_trunc('month', current_date - interval '4' month) as mydate

e.g. Current date is, 2022-01-03 19:30:00

Output is, 2022-09-01 00:00:00

Method 2:

SELECT CURRENT_DATE - INTERVAL '4 months' as mydate

e.g. Current date is, 2022-01-03 19:30:00

Output is, 2022-09-03 00:00:00

Pentaho - Read file and store content in the memory

 Step Name : Load file content in memory


Returns two columns, 

1. File Content

2. File Size

Penatho - Expressions

Compare two columns:

Source:


Comparison:


Pentaho Steps:




Use 'User Defined Java Expression' step in the pentho to achieve this, some sample expressions are below,

Count.equals(Tgt_Count) ? "TRUE" : "FALSE"

Value Type : String


Count<=Tgt_Count ? "OK" : "NOTOK"

Value Type : String

Kiro - Core Features

What is Kiro Kiro is an innovative AI-powered IDE that revolutionizes software development through intelligent assistance and structured wor...