use of com.thinkbiganalytics.schema.QueryRunner in project kylo by Teradata.
the class DBCPConnectionPoolService method executeQueryForControllerService.
/**
* Executes the specified SELECT query in the context of the specified controller service.
*
* @param serviceProperties properties describing the data source and the query
* @return the query results
* @throws DataAccessException if the query cannot be executed
*/
@Nonnull
private QueryResult executeQueryForControllerService(@Nonnull final PoolingDataSourceService.DataSourceProperties dataSourceProperties, @Nonnull final ExecuteQueryControllerServiceRequest serviceProperties) {
if (evaluateWithUserDefinedDatasources(dataSourceProperties, serviceProperties)) {
log.info("Execute query against Controller Service: {} ({}) with uri of {}. ", serviceProperties.getControllerServiceName(), serviceProperties.getControllerServiceId(), dataSourceProperties.getUrl());
final DataSource dataSource = PoolingDataSourceService.getDataSource(dataSourceProperties);
return new QueryRunner(dataSource).query(serviceProperties.getQuery());
} else {
throw new DataAccessResourceFailureException("Unable to determine connection properties for controller service: " + serviceProperties.getControllerServiceName() + "(" + serviceProperties.getControllerServiceId() + ")");
}
}
Aggregations