Skip to content

Commit

Permalink
fix: fix sql to cel conversion (#2662)
Browse files Browse the repository at this point in the history
Co-authored-by: Tal <[email protected]>
  • Loading branch information
35C4n0r and talboren authored Dec 1, 2024
1 parent a3b9303 commit 1c88c63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions keep-ui/app/(keep)/alerts/alerts-rules-builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ export const AlertsRulesBuilder = ({
const convertSQLToCEL = (sql: string): string | null => {
try {
const query = parseSQL(sql);
// Validate the parsed query
if (!query || !query.rules || query.rules.length === 0) {
throw new Error("Invalid SQL query: No rules generated.");
}
const formattedCel = formatQuery(query, "cel");
return formatQuery(parseCEL(formattedCel), "cel");
} catch (error) {
Expand Down

0 comments on commit 1c88c63

Please sign in to comment.