def validate(self, **kwargs): client = self.get_client() if not client: raise KqlEngineError("Client is not defined.") query = "range c from 1 to 10 step 1 | count" response = client.execute(self.get_database(), query, accept_partial_results=False, timeout=None) # print(response.json_response) table = KqlResponse(response, **kwargs).tables[0] if table.rowcount() != 1 or table.colcount() != 1 or [ r for r in table.fetchall() ][0][0] != 10: raise KqlEngineError("Client failed to validate connection.")
def validate(self, **options): client = self.get_client() if not client: raise KqlEngineError("Client is not defined.") # query = "range c from 1 to 10 step 1 | count" filename = self._VALIDATION_FILE_NAME database = self.get_database() response = client.execute(database, filename, accept_partial_results=False, **options) # print(response.json_response) table = KqlResponse(response, **options).tables[0] if table.rowcount() != 1 or table.colcount() != 1 or [ r for r in table.fetchall() ][0][0] != 10: raise KqlEngineError("Client failed to validate connection.")
def validate(self, **kwargs): ip = get_ipython() root_path = ip.starting_dir.replace("\\", "/") client = self.get_client() if not client: raise KqlEngineError("Client is not defined.") # query = "range c from 1 to 10 step 1 | count" filename = 'validation_file.json' database = self.get_database() response = client.execute(database, filename, accept_partial_results=False, timeout=None) # print(response.json_response) table = KqlResponse(response, **kwargs).tables[0] if table.rowcount() != 1 or table.colcount() != 1 or [ r for r in table.fetchall() ][0][0] != 10: raise KqlEngineError("Client failed to validate connection.")
def execute(self, query, user_namespace=None, **kwargs): if query.strip(): response = self.client_execute(query, user_namespace, **kwargs) # print(response.json_response) return KqlResponse(response, **kwargs)