本文整理汇总了Java中org.pentaho.di.trans.steps.tableinput.TableInputMeta.setSQL方法的典型用法代码示例。如果您正苦于以下问题:Java TableInputMeta.setSQL方法的具体用法?Java TableInputMeta.setSQL怎么用?Java TableInputMeta.setSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.trans.steps.tableinput.TableInputMeta
的用法示例。
在下文中一共展示了TableInputMeta.setSQL方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableInputStep
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private StepMeta getTableInputStep(GraphConfigurationInfo configurationInfo)
throws GraphGeneratorException {
TableInputMeta tableInput = new TableInputMeta();
tableInput.setDatabaseMeta(getDatabaseMeta(configurationInfo));
tableInput.setSQL(configurationInfo.getTableInputSqlQuery());
//
StepMeta tableInputStep =
new StepMeta(GraphGeneratorConstants.TABLE_INPUT, (StepMetaInterface) tableInput);
xAxixLocation += 120;
tableInputStep.setLocation(xAxixLocation, yAxixLocation);
//
tableInputStep.setDraw(true);
tableInputStep
.setDescription("Read Data From Fact Table: " + GraphGeneratorConstants.TABLE_INPUT);
return tableInputStep;
}
示例2: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo(TableInputMeta meta)
{
meta.setSQL( wSQL.getText() );
meta.setDatabaseMeta( transMeta.findDatabase(wConnection.getText()) );
meta.setRowLimit( Const.toInt(wLimit.getText(), 0) );
meta.setLookupFromStep( transMeta.findStep( wDatefrom.getText() ) );
meta.setExecuteEachInputRow(wEachRow.getSelection());
meta.setVariableReplacementActive(wVariables.getSelection());
meta.setLazyConversionActive(wLazyConversion.getSelection());
}
示例3: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo(TableInputMeta meta, boolean preview)
{
meta.setSQL(preview && !Const.isEmpty(wSQL.getSelectionText())?wSQL.getSelectionText():wSQL.getText());
meta.setDatabaseMeta( transMeta.findDatabase(wConnection.getText()) );
meta.setRowLimit( wLimit.getText() );
StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
infoStream.setStepMeta( transMeta.findStep( wDatefrom.getText() ) );
meta.setExecuteEachInputRow(wEachRow.getSelection());
meta.setVariableReplacementActive(wVariables.getSelection());
meta.setLazyConversionActive(wLazyConversion.getSelection());
}
示例4: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo(TableInputMeta meta, boolean preview) {
meta.setSQL(preview && !Const.isEmpty(wSQL.getSelectionText()) ? wSQL.getSelectionText() : wSQL.getText());
meta.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
meta.setRowLimit(wLimit.getText());
StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
infoStream.setStepMeta(transMeta.findStep(wDatefrom.getText()));
meta.setExecuteEachInputRow(wEachRow.getSelection());
meta.setVariableReplacementActive(wVariables.getSelection());
meta.setLazyConversionActive(wLazyConversion.getSelection());
}
示例5: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo( TableInputMeta meta, boolean preview ) {
meta.setSQL( preview && !Utils.isEmpty( wSQL.getSelectionText() ) ? wSQL.getSelectionText() : wSQL.getText() );
meta.setDatabaseMeta( transMeta.findDatabase( wConnection.getText() ) );
meta.setRowLimit( wLimit.getText() );
StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get( 0 );
infoStream.setStepMeta( transMeta.findStep( wDatefrom.getText() ) );
meta.setExecuteEachInputRow( wEachRow.getSelection() );
meta.setVariableReplacementActive( wVariables.getSelection() );
meta.setLazyConversionActive( wLazyConversion.getSelection() );
}
示例6: testCombinationLookup
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
public void testCombinationLookup() throws Exception
{
EnvUtil.environmentInit();
try
{
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("transname");
// Add the database connections
for (int i=0;i<databasesXML.length;i++)
{
DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
transMeta.addDatabase(databaseMeta);
}
DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");
// Execute our setup SQLs in the database.
Database lookupDatabase = new Database(lookupDBInfo);
lookupDatabase.connect();
createTables(lookupDatabase);
createData(lookupDatabase);
StepLoader steploader = StepLoader.getInstance();
//
// create the source step...
//
String fromstepname = "read from [" + source_table + "]";
TableInputMeta tii = new TableInputMeta();
tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
String selectSQL = "SELECT "+Const.CR;
selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
tii.setSQL(selectSQL);
String fromstepid = steploader.getStepPluginID(tii);
StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
fromstep.setLocation(150, 100);
fromstep.setDraw(true);
fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
transMeta.addStep(fromstep);
//
// create the combination lookup/update step...
//
String lookupstepname = "lookup from [lookup]";
CombinationLookupMeta clm = new CombinationLookupMeta();
String lookupKey[] = { "DLR_CD" };
clm.setTablename(target_table);
clm.setKeyField(lookupKey);
clm.setKeyLookup(lookupKey);
clm.setTechnicalKeyField("ID");
clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
clm.setDatabaseMeta(lookupDBInfo);
String lookupstepid = steploader.getStepPluginID(clm);
StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
transMeta.addStep(lookupstep);
TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
transMeta.addTransHop(hi);
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.execute(null);
trans.waitUntilFinished();
checkResults(lookupDatabase);
}
finally {}
}
示例7: testCombinationLookup
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
public void testCombinationLookup() throws Exception
{
KettleEnvironment.init();
try
{
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("transname");
// Add the database connections
for (int i=0;i<databasesXML.length;i++)
{
DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
transMeta.addDatabase(databaseMeta);
}
DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");
// Execute our setup SQLs in the database.
Database lookupDatabase = new Database(transMeta, lookupDBInfo);
lookupDatabase.connect();
createTables(lookupDatabase);
createData(lookupDatabase);
PluginRegistry registry = PluginRegistry.getInstance();
//
// create the source step...
//
String fromstepname = "read from [" + source_table + "]";
TableInputMeta tii = new TableInputMeta();
tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
String selectSQL = "SELECT "+Const.CR;
selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
tii.setSQL(selectSQL);
String fromstepid = registry.getPluginId(StepPluginType.class, tii);
StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
fromstep.setLocation(150, 100);
fromstep.setDraw(true);
fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
transMeta.addStep(fromstep);
//
// create the combination lookup/update step...
//
String lookupstepname = "lookup from [lookup]";
CombinationLookupMeta clm = new CombinationLookupMeta();
String lookupKey[] = { "DLR_CD" };
clm.setTablename(target_table);
clm.setKeyField(lookupKey);
clm.setKeyLookup(lookupKey);
clm.setTechnicalKeyField("ID");
clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
clm.setDatabaseMeta(lookupDBInfo);
String lookupstepid = registry.getPluginId(StepPluginType.class, clm);
StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
transMeta.addStep(lookupstep);
TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
transMeta.addTransHop(hi);
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.execute(null);
trans.waitUntilFinished();
checkResults(lookupDatabase);
}
finally {}
}
示例8: generateTableInputStepFromLogicalTable
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private StepMeta generateTableInputStepFromLogicalTable(LogicalTable logicalTable) {
String name = ConceptUtil.getName(logicalTable, locale);
String description = ConceptUtil.getDescription(logicalTable, locale);
TableInputMeta meta = new TableInputMeta();
// Source database, retain first
// Source table, retain first
// Source columns, retain all
//
DatabaseMeta sourceDatabaseMeta = null;
String sourceTable = null;
List<String> sourceColumns = new ArrayList<String>();
for (LogicalColumn column : logicalTable.getLogicalColumns()) {
String phDb = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_DB);
String phTable = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE);
String phCol = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN);
if (!Const.isEmpty(phDb) && sourceDatabaseMeta==null) {
sourceDatabaseMeta = DatabaseMeta.findDatabase(databases, phDb);
}
if (!Const.isEmpty(phTable)) {
sourceTable = phDb;
}
if (!Const.isEmpty(phCol)) {
sourceColumns.add(phCol);
}
}
String sql = "SELECT * FROM --< Source query for dimension '"+name+"'";
meta.setDatabaseMeta(sourceDatabaseMeta);
if (sourceDatabaseMeta!=null && !Const.isEmpty(sourceTable)) {
sql = "SELECT ";
if (sourceColumns.isEmpty()) {
sql+=" * ";
} else {
sql+=Const.CR;
}
boolean first=true;
for (String sourceColumn : sourceColumns) {
if (first) {
first=false;
} else {
sql+=" , ";
}
sql+=sourceDatabaseMeta.quoteField(sourceColumn)+Const.CR;
}
sql+="FROM "+sourceDatabaseMeta.getQuotedSchemaTableCombination(null, sourceTable);
}
meta.setSQL(sql);
// Wrap it up...
//
StepMeta stepMeta = new StepMeta("Source data for '"+name+"'", meta);
stepMeta.drawStep();
stepMeta.setDescription("Reads data for '"+name+"' : "+description);
return stepMeta;
}
示例9: testCombinationLookup
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
public void testCombinationLookup() throws Exception {
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName( "transname" );
// Add the database connections
for ( int i = 0; i < databasesXML.length; i++ ) {
DatabaseMeta databaseMeta = new DatabaseMeta( databasesXML[i] );
transMeta.addDatabase( databaseMeta );
}
DatabaseMeta lookupDBInfo = transMeta.findDatabase( "lookup" );
// Execute our setup SQLs in the database.
Database lookupDatabase = new Database( transMeta, lookupDBInfo );
lookupDatabase.connect();
createTables( lookupDatabase );
createData( lookupDatabase );
PluginRegistry registry = PluginRegistry.getInstance();
//
// create the source step...
//
String fromstepname = "read from [" + source_table + "]";
TableInputMeta tii = new TableInputMeta();
tii.setDatabaseMeta( transMeta.findDatabase( "lookup" ) );
String selectSQL = "SELECT " + Const.CR;
selectSQL += "DLR_CD, DLR_NM, DLR_DESC ";
selectSQL += "FROM " + source_table + " ORDER BY ORDNO;";
tii.setSQL( selectSQL );
String fromstepid = registry.getPluginId( StepPluginType.class, tii );
StepMeta fromstep = new StepMeta( fromstepid, fromstepname, tii );
fromstep.setLocation( 150, 100 );
fromstep.setDraw( true );
fromstep.setDescription( "Reads information from table ["
+ source_table + "] on database [" + lookupDBInfo + "]" );
transMeta.addStep( fromstep );
//
// create the combination lookup/update step...
//
String lookupstepname = "lookup from [lookup]";
CombinationLookupMeta clm = new CombinationLookupMeta();
String[] lookupKey = { "DLR_CD" };
clm.setTablename( target_table );
clm.setKeyField( lookupKey );
clm.setKeyLookup( lookupKey );
clm.setTechnicalKeyField( "ID" );
clm.setTechKeyCreation( CombinationLookupMeta.CREATION_METHOD_TABLEMAX );
clm.setDatabaseMeta( lookupDBInfo );
String lookupstepid = registry.getPluginId( StepPluginType.class, clm );
StepMeta lookupstep = new StepMeta( lookupstepid, lookupstepname, clm );
lookupstep.setDescription( "Looks up information from table [lookup] on database [" + lookupDBInfo + "]" );
transMeta.addStep( lookupstep );
TransHopMeta hi = new TransHopMeta( fromstep, lookupstep );
transMeta.addTransHop( hi );
// Now execute the transformation...
Trans trans = new Trans( transMeta );
trans.execute( null );
trans.waitUntilFinished();
checkResults( lookupDatabase );
}
示例10: generateTableInputStepFromLogicalTable
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private StepMeta generateTableInputStepFromLogicalTable(LogicalTable logicalTable) {
String name = ConceptUtil.getName(logicalTable, locale);
String description = ConceptUtil.getDescription(logicalTable, locale);
TableInputMeta meta = new TableInputMeta();
// Source database, retain first
// Source table, retain first
// Source columns, retain all
//
DatabaseMeta sourceDatabaseMeta = null;
String sourceTable = null;
List<String> sourceColumns = new ArrayList<String>();
for (LogicalColumn column : logicalTable.getLogicalColumns()) {
String phDb = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_DB);
String phTable = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE);
String phCol = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN);
if (!Utils.isEmpty(phDb) && sourceDatabaseMeta==null) {
sourceDatabaseMeta = DatabaseMeta.findDatabase(databases, phDb);
}
if (!Utils.isEmpty(phTable)) {
sourceTable = phDb;
}
if (!Utils.isEmpty(phCol)) {
sourceColumns.add(phCol);
}
}
String sql = "SELECT * FROM --< Source query for dimension '"+name+"'";
meta.setDatabaseMeta(sourceDatabaseMeta);
if (sourceDatabaseMeta!=null && !Utils.isEmpty(sourceTable)) {
sql = "SELECT ";
if (sourceColumns.isEmpty()) {
sql+=" * ";
} else {
sql+=Const.CR;
}
boolean first=true;
for (String sourceColumn : sourceColumns) {
if (first) {
first=false;
} else {
sql+=" , ";
}
sql+=sourceDatabaseMeta.quoteField(sourceColumn)+Const.CR;
}
sql+="FROM "+sourceDatabaseMeta.getQuotedSchemaTableCombination(null, sourceTable);
}
meta.setSQL(sql);
// Wrap it up...
//
StepMeta stepMeta = new StepMeta("Source data for '"+name+"'", meta);
stepMeta.drawStep();
stepMeta.setDescription("Reads data for '"+name+"' : "+description);
return stepMeta;
}