def METHOD_NAME(self, query, user):
    kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(
        connection_string=self.configuration["cluster"],
        aad_app_id=self.configuration["azure_ad_client_id"],
        app_key=self.configuration["azure_ad_client_secret"],
        authority_id=self.configuration["azure_ad_tenant_id"],
    )
    client = KustoClient(kcsb)
    db = self.configuration["database"]
    try:
        response = client.execute(db, query, self.client_request_properties)
        result_cols = response.primary_results[0].columns
        result_rows = response.primary_results[0].rows
        columns = []
        rows = []
        for c in result_cols:
            columns.append(
                {
                    "name": c.column_name,
                    "friendly_name": c.column_name,
                    "type": TYPES_MAP.get(c.column_type, None),
                }
            )
        # rows must be [{'column1': value, 'column2': value}]
        for row in result_rows:
            rows.append(row.to_dict())
        error = None
        data = {"columns": columns, "rows": rows}
        json_data = json_dumps(data)
    except KustoServiceError as err:
        json_data = None
        try:
            error = err.args[1][0]["error"]["@message"]
        except (IndexError, KeyError):
            error = err.args[1]
    return json_data, error