Interface IDataSourceQueryService
-
public interface IDataSourceQueryServiceA service that supports executing queries on a data source configured in the DSS service.properties.Jython usage example:
results = query_service.select("data-source-name", "SELECT * FROM table_name WHERE id > 1") [... do stuff with results] results.close()If you need to do this frequently, you may want to extract this into a function
def execute_query(query_service, block, query, params=None): if params is None: result = query_service.select("data-source-name", query) else: result = query_service.select("data-source-name", query, params) block(result) result.close()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description net.lemnik.eodsql.DataSet<java.util.Map<java.lang.String,java.lang.Object>>select(java.lang.String dataSourceName, java.lang.String query)Execute a query against the data source with the specified name.net.lemnik.eodsql.DataSet<java.util.Map<java.lang.String,java.lang.Object>>select(java.lang.String dataSourceName, java.lang.String query, java.lang.Object... parameters)Execute a query against the data source with the specified name.
-
-
-
Method Detail
-
select
net.lemnik.eodsql.DataSet<java.util.Map<java.lang.String,java.lang.Object>> select(java.lang.String dataSourceName, java.lang.String query) throws java.lang.IllegalArgumentExceptionExecute a query against the data source with the specified name.- Parameters:
dataSourceName- The name of the data source to query against, as declared in the service.properties file.query- The SQL query to execute, possibly including parameters marked by '?{X}' where X is the parameter number.- Returns:
- A List of Maps with the data. Do not forget to close the result when done!
- Throws:
java.lang.IllegalArgumentException
-
select
net.lemnik.eodsql.DataSet<java.util.Map<java.lang.String,java.lang.Object>> select(java.lang.String dataSourceName, java.lang.String query, java.lang.Object... parameters) throws java.lang.IllegalArgumentExceptionExecute a query against the data source with the specified name.- Parameters:
dataSourceName- The name of the data source to query against, as declared in the service.properties file.query- The SQL query to execute, possibly including parameters marked by '?{X}' where X is the parameter number.parameters- The values for filling in the query parameters.- Returns:
- A List of Maps with the data. Do not forget to close the result when done!
- Throws:
java.lang.IllegalArgumentException
-
-