Exemple #1
0
    def exec_query(self, table=None, sql=None):
        """Execute a SQL Query that return a single result.

      """
        nosql_result = []

        query_request = QueryRequest()
        nosql_request = query_request.set_statement(sql)
        query_request.close()

        nosql_result = self._nosql_handle.query(query_request)

        return nosql_result.get_results()
Exemple #2
0
    def exec_query_loop(self, table=None, sql=None):
        """Execute a SQL Query that return multiples results.

      """
        nosql_result = []

        query_request = QueryRequest()
        nosql_request = query_request.set_statement(sql)
        query_request.close()

        while True:
            nosql_exec_query = self._nosql_handle.query(query_request)
            nosql_result = nosql_exec_query.get_results()

            if len(nosql_result) > 0:
                break

            if nosql_request.is_done():
                break

        return nosql_result