How to conditionally force fail a query in KustoKusto Query Earliest and Latest date in the Past 21 daysAdd source database name as column in row results for KustoHow to write a Kusto query to find two consecutive rows that have the same value in a fieldCan you use a variable to define column name in a Kusto query?Can I use tabular parameters in Kusto user-defined functionsAzure Data Explorer (Kusto) override creationTimeKusto Query from c#Turn series to columns in Kusto/Azure Data ExplorerSaving data to Kusto DBCreating a Kusto table with table name coming from query result
Why A=2 and B=1 in the call signs for Spirit and Opportunity?
Why did Jon Snow do this immoral act if he is so honorable?
Finding all files with a given extension whose base name is the name of the parent directory
Why did other houses not demand this?
Grade-school elementary algebra presented in an abstract-algebra style?
Creating second map without labels using QGIS?
Where is Jon going?
Who knighted this Game of Thrones character?
Of strange atmospheres - the survivable but unbreathable
Are runways booked by airlines to land their planes?
Cardio work for Muay Thai fighters
How does the Earth's center produce heat?
Testing using real data of the customer
Why isn't 'chemically-strengthened glass' made with potassium carbonate? To begin with?
Is my plasma cannon concept viable?
First Program Tic-Tac-Toe
Time complexity of an algorithm: Is it important to state the base of the logarithm?
Would Buddhists help non-Buddhists continuing their attachments?
Why do Russians almost not use verbs of possession akin to "have"?
How was Daenerys able to legitimise Gendry?
Expected maximum number of unpaired socks
On San Andreas Speedruns, why do players blow up the Picador in the mission Ryder?
How to determine if a hyphen (-) exists inside a column
Why would a rational buyer offer to buy with no conditions precedent?
How to conditionally force fail a query in Kusto
Kusto Query Earliest and Latest date in the Past 21 daysAdd source database name as column in row results for KustoHow to write a Kusto query to find two consecutive rows that have the same value in a fieldCan you use a variable to define column name in a Kusto query?Can I use tabular parameters in Kusto user-defined functionsAzure Data Explorer (Kusto) override creationTimeKusto Query from c#Turn series to columns in Kusto/Azure Data ExplorerSaving data to Kusto DBCreating a Kusto table with table name coming from query result
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
How do I force a query to actually fail in Kusto depending on certain condition? Ideally the exact I need to force failure is the query returns 0 count.
MyTable | count | where Count==0 ... the query should fail
I am looking for actual technical failure and not just nulls etc. Basically if a certain query returns 0 count , I want the query to fail so that the corresponding Web API call will also get appropriate failure return code.
kusto azure-data-explorer
add a comment |
How do I force a query to actually fail in Kusto depending on certain condition? Ideally the exact I need to force failure is the query returns 0 count.
MyTable | count | where Count==0 ... the query should fail
I am looking for actual technical failure and not just nulls etc. Basically if a certain query returns 0 count , I want the query to fail so that the corresponding Web API call will also get appropriate failure return code.
kusto azure-data-explorer
add a comment |
How do I force a query to actually fail in Kusto depending on certain condition? Ideally the exact I need to force failure is the query returns 0 count.
MyTable | count | where Count==0 ... the query should fail
I am looking for actual technical failure and not just nulls etc. Basically if a certain query returns 0 count , I want the query to fail so that the corresponding Web API call will also get appropriate failure return code.
kusto azure-data-explorer
How do I force a query to actually fail in Kusto depending on certain condition? Ideally the exact I need to force failure is the query returns 0 count.
MyTable | count | where Count==0 ... the query should fail
I am looking for actual technical failure and not just nulls etc. Basically if a certain query returns 0 count , I want the query to fail so that the corresponding Web API call will also get appropriate failure return code.
kusto azure-data-explorer
kusto azure-data-explorer
asked Mar 23 at 23:53
DhirajDhiraj
7641435
7641435
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Can you check if assert() function helps your scenario?
https://docs.microsoft.com/en-us/azure/kusto/query/assert-function
let Count = toscalar(
range x from 1 to 1 step 1 | count
);
print assert(Count != 0, "Count must be non-zero")
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319473%2fhow-to-conditionally-force-fail-a-query-in-kusto%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can you check if assert() function helps your scenario?
https://docs.microsoft.com/en-us/azure/kusto/query/assert-function
let Count = toscalar(
range x from 1 to 1 step 1 | count
);
print assert(Count != 0, "Count must be non-zero")
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
add a comment |
Can you check if assert() function helps your scenario?
https://docs.microsoft.com/en-us/azure/kusto/query/assert-function
let Count = toscalar(
range x from 1 to 1 step 1 | count
);
print assert(Count != 0, "Count must be non-zero")
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
add a comment |
Can you check if assert() function helps your scenario?
https://docs.microsoft.com/en-us/azure/kusto/query/assert-function
let Count = toscalar(
range x from 1 to 1 step 1 | count
);
print assert(Count != 0, "Count must be non-zero")
Can you check if assert() function helps your scenario?
https://docs.microsoft.com/en-us/azure/kusto/query/assert-function
let Count = toscalar(
range x from 1 to 1 step 1 | count
);
print assert(Count != 0, "Count must be non-zero")
answered Mar 29 at 5:59
Alexander SloutskyAlexander Sloutsky
4264
4264
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
add a comment |
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
I tried it, but it is not failing the query. It printed 1 and not the error message(the second argument). And also when I checked the QueryStatus tab of Kusto Explorer, it shows that query completed successfully.
– Dhiraj
Mar 29 at 20:39
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
Ok I figured out, your code is correct, the only issue is that you provided positive condition as the argument, as per the documentation it should be false condition. If I do that, it works. Thanks.
– Dhiraj
Mar 29 at 20:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319473%2fhow-to-conditionally-force-fail-a-query-in-kusto%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown