use of org.knime.core.node.port.database.DatabasePortObject in project knime-core by knime.
the class DBAutoBinnerNodeModel method configure.
/**
* {@inheritDoc}
*/
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
final DatabasePortObjectSpec dbSpec = (DatabasePortObjectSpec) inSpecs[0];
DatabaseQueryConnectionSettings connectionSettings = dbSpec.getConnectionSettings(getCredentialsProvider());
boolean suppCase = connectionSettings.getUtility().supportsCase();
if (!suppCase) {
if (m_settings.getFilterConfiguration().applyTo(dbSpec.getDataTableSpec()).getIncludes().length > 1) {
throw new InvalidSettingsException("Database does not support \"CASE\". Please choose only one column.");
}
}
if (connectionSettings.getRetrieveMetadataInConfigure()) {
PMMLPortObject pmmlPortObject = createPMMLPortObject(dbSpec, connectionSettings, new ExecutionMonitor());
DatabasePortObject databasePortObject = createDatabasePortObject(dbSpec, connectionSettings, pmmlPortObject);
return new PortObjectSpec[] { databasePortObject.getSpec(), pmmlPortObject.getSpec() };
}
return new PortObjectSpec[] { null, null };
}
use of org.knime.core.node.port.database.DatabasePortObject in project knime-core by knime.
the class DBAutoBinnerNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected final PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws CanceledExecutionException, Exception {
exec.setMessage("Retrieving metadata from database");
final DatabasePortObject dbObject = (DatabasePortObject) inData[0];
final DatabasePortObjectSpec inSpec = dbObject.getSpec();
DatabaseQueryConnectionSettings connectionSettings = inSpec.getConnectionSettings(getCredentialsProvider());
PMMLPortObject pmmlPortObject = createPMMLPortObject(inSpec, connectionSettings, exec);
DatabasePortObject databasePortObject = createDatabasePortObject(inSpec, connectionSettings, pmmlPortObject);
return new PortObject[] { databasePortObject, pmmlPortObject };
}
use of org.knime.core.node.port.database.DatabasePortObject in project knime-core by knime.
the class DBApplyBinnerNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected final PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws CanceledExecutionException, Exception {
PMMLPortObject pmmlPortObject = (PMMLPortObject) inData[0];
DatabasePortObject databasePortObject = (DatabasePortObject) inData[1];
DatabaseQueryConnectionSettings connectionSettings = databasePortObject.getConnectionSettings(getCredentialsProvider());
return new PortObject[] { createDatabasePortObject(databasePortObject.getSpec(), connectionSettings, pmmlPortObject) };
}
use of org.knime.core.node.port.database.DatabasePortObject in project knime-core by knime.
the class DBNumericBinnerNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected final PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws CanceledExecutionException, Exception {
exec.setMessage("Retrieving metadata from database");
checkDuplicateBinNames();
final DatabasePortObject inDatabasePortObject = (DatabasePortObject) inData[0];
final DatabasePortObjectSpec inDatabasePortObjectSpec = inDatabasePortObject.getSpec();
DatabaseQueryConnectionSettings connectionSettings = inDatabasePortObject.getConnectionSettings(getCredentialsProvider());
DataTableSpec outDataTableSpec = DBAutoBinner.createNewDataTableSpec(inDatabasePortObjectSpec.getDataTableSpec(), m_columnToAppended);
PMMLPortObject outPMMLPortObject = createPMMLPortObject(inDatabasePortObjectSpec.getDataTableSpec(), outDataTableSpec);
DBBinnerMaps binnerMaps = DBAutoBinner.intoBinnerMaps(outPMMLPortObject, inDatabasePortObjectSpec.getDataTableSpec());
DatabasePortObjectSpec outDatabasePortObjectSpec = createDatabasePortObjectSpec(connectionSettings, inDatabasePortObjectSpec, binnerMaps);
return new PortObject[] { new DatabasePortObject(outDatabasePortObjectSpec), outPMMLPortObject };
}
use of org.knime.core.node.port.database.DatabasePortObject in project knime-core by knime.
the class DBColumnRenameNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
final DatabasePortObject dbObject = (DatabasePortObject) inObjects[0];
final DatabasePortObject outObject = new DatabasePortObject(createDBOutSpec(dbObject.getSpec()));
return new PortObject[] { outObject };
}
Aggregations