Tuesday, 16 August 2016

CASE Example in POSTGRES

SELECT  
CASE WHEN "EQU000"."city_C"= 'abc'
THEN 'cityNAME'
ELSE 'Group'
END AS "NAME"
FROM "EQU000" 

Getting Rowcount of all the tables in POSTGRES

SELECT
  nspname AS schemaname,relname,reltuples
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE
  nspname NOT IN ('pg_catalog', 'information_schema') AND
  relkind='r'
ORDER BY reltuples DESC;

Describing Table in POSTGERS (DESC in Oracle)

Describing Table :

select column_name, data_type, character_maximum_length
from INFORMATION_SCHEMA.COLUMNS where table_name = 'EQUI_HDR';

OVER PARTITION ..... ROW_NUMBER Example in POSTGRES

select * from (
SELECT "PROCE_UNIT_C" ,"EQUI_C" ,"COMPO_C" ,"COMPO_TYPE_C","CUIF_INS_CAT",
row_number() over(PARTITION BY "PROCE_UNIT_C", "EQUIP_C","COMPO_C","COMPO_TYPE_C","CUIF_INS_CAT")  "Row_Number",
count("CUIF_INS_CAT") over(PARTITION BY "PROCE_UNIT_C", "EQUI_C","COMPO_C","COMPO_TYPE_C","CUIF_INS_CAT"),
CHR(min(ASCII("CUIF_INS_CAT")) over(PARTITION BY "PROCE_UNIT_C", "EQUI_C","COMPO_C","COMPO_TYPE_C"))
FROM
"INSPHISTORY" ) "a"
where "a"."Row_Number"=1

Wednesday, 27 July 2016

LOGIC OF==ALPABETIC===ALPHANUMERIC===NUMERIC===NEGATIVENO===checking in TALEND

**AlphaNumeric||length > 5|| ==0 then reject else Accept

b=myString.matches("[0-9]+") ? myString.length() > 5 || myString.matches("0") ? "false" : "true" : "false";

**AlphaNumeric
myString.matches("[A-Za-z0-9]+")

**Numeric
myString.matches("[0-9]+"))

**Negative
myString.matches("-[0-9]+"))

**Alphabetic
myString.matches("[A-Za-z]+")


Eg:

* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
 public static void main (String[] args) throws java.lang.Exception
 {
  String myString = "-123456";
System.out.println(myString.matches("[A-Za-z0-9]+"));

String a=(myString.matches("[A-Za-z]+")) ? "String1" :

(myString.matches("[0-9]+")) ? myString.length() > 5 ? ">5" : "Good" :
(myString.matches("-[0-9]+")) ? "Negative" : "none";

System.out.println("hi"+a);

if(myString.matches("[A-Za-z]+"))
{
 System.out.println("String");
}
else
{   if(myString.matches("[0-9]+"))
      {
         System.out.println("Number");
      }
}    

System.out.println(myString.matches("[A-Za-z]+"));
 }
}

BUSINESS MODEL in TALEND

Business Model
Talend's Business Models allow data integration project stakeholders to graphically represent their needs regardless of the technical implementation requirements. Business Models help the IT operation staff understand these expressed needs and translate them into technical processes (Jobs).

•draw your business needs,
•create and assign numerous repository items to your model objects,
•define the business model properties of your model objects.


All objects are represented in the Palette as shapes, and can be included in the model.

Shapes

Select the shape corresponding to the relevant object you want to include in your Business Model. Double-click it or click the shape in the Palette and drop it in the modeling area.

Alternatively, for a quick access to the shape library, keep your cursor still on the modeling area for a couple of seconds to display the quick access toolbar:



Terminal--The rounded corner square can illustrate any type of output terminal.

List--forms a list with the extracted data. The list can be defined to hold a certain nature of data.

InpuT--Inserts an input object allowing the user to type in or manually provide data to be processed.

Gear--This gearing piece can be used to illustrate pieces of code programmed manually that should be replaced by a Talend Job for example.

Ellipse--Inserts an ellipse shape.

Document--Inserts a Document object which can be any type of document and can be used as input or output for the data processed.

Decision--The diamond shape generally represents an if condition in the model. Allows to take context-sensitive actions.

Database--Inserts a database object which can hold the input or output data to be processed.

Data--A parallelogram shape symbolize data of any type.

Actor--This schematic character symbolizes players in the decision-support as well technical processes.

Action--The square shape can be used to symbolize actions of any nature, such as transformation, translation or formatting.

Assignment tab

The Assignment tab displays in a tabular form details of the Repository attributes you allocated to a shape or a connection.

To display any assignment information in the table, select a shape or a connection in the active model, then click the Assignment tab in the Business Model view.

You can also display the assignment list placing the mouse over the shape you assigned information to.


Assigning repository elements to a Business Model
The Assignment tab in the Business Models view lists the elements from the Repository tree view which have been assigned to a shape in the Business Model.
You can define or describe a particular object in your Business Model by simply associating it with various types of information, for example by adding metadata items.

You can set the nature of the metadata to be assigned or processed, thus facilitating the Job design phase.

To assign a metadata item, simply drop it from the Repository tree view to the relevant shape in the design workspace.

The Assignment table, located underneath the design workspace, gets automatically updated accordingly with the assigned information of the selected object.

The types of items that you can assign are:

Job designs--If any Job Designs developed for other projects in the same repository are available, you can reuse them as metadata in the active Business Model.
Metadata--You can assign any descriptive data stored in the repository to any of the objects used in the model. It can be connection information to a database for example.
Business Models--You can use in the active model all other Business Models stored in the repository of the same project.
Documentation--You can assign any type of documentation in any format. It can be a technical documentation, some guidelines in text format or a simple description of your databases.
Routines (Code)--If you have developed some routines in a previous project, to automate tasks for example, you can assign them to your Business Model. Routines are stored in the Code folder of the Repository tree view.



Talend Activity Monitoring Console (AMC )


Activity monitoring information can be stored in delimited files or database tables.

Before collecting and reusing the activity monitoring information of your Talend Jobs, you have to:

•Create files or database tables to be used as datasources for the activity monitoring information.

•Enable activity monitoring either by configuring the Stats & Logs settings at the project level or Job level or by adding the relevant components to your Jobs in order to catch and record the activity monitoring information and deliver it to the defined output (files or database tables).

•Configure the datasources to retrieve the activity monitoring information, which can be displayed on Talend Activity Monitoring Console either from the studio or from the Monitoring module of Talend Administration Center.


Different Views in AMC :

Jobs vieW--The Jobs view provides the list of Jobs mentioned in the execution log data collected.
The History view provides a summary of the Job main steps.
The Detailed History view splits up each Job into components and provides the execution details.
The Main Chart view displays a pie chart representing for each component, its respective share of the execution time.
The Meter Log view displays the detailed information of the various flows processed in the Job selected on the Jobs view.
The Logged Events view displays in full the messages generated through tWarn or tDie components as well as Java Exception
The Error Report view provides an analysis of the proportion of errors that occurred over a number of Job executions
The Job Volume view displays a line chart representing the volumetrics of the flow being processed. Depending on the tFlowMeter component settings on your Talend Job design, the scale and units will differ.
The Threshold chart view displays the proportion of the flow measured.

Are You Thinking?????????????????????

                      Question Yourself for few Seconds?                         Are you Thinking at all?                              When ...