-
Notifications
You must be signed in to change notification settings - Fork 155
allow CTES in SQL editor #653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed 971b3cf in 47 seconds. Click for details.
- Reviewed
12lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/lib/sql/transpile.ts:98
- Draft comment:
Removed debug logging. Avoid use of console.log in production; use proper logger if needed. - Reason this comment was not posted:
Comment looked like it was already resolved.
Workflow ID: wflow_H98V1jRVFO9rdgy1
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Changes requested ❌
Reviewed everything up to ea36d65 in 1 minute and 49 seconds. Click for details.
- Reviewed
52lines of code in1files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/lib/sql/transpile.ts:45
- Draft comment:
New 'withAliases' property added. Ensure that its use (e.g. via union) is supported in your JS environment. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to ensure that the new 'withAliases' property is supported in their JS environment. This falls under the rule of not asking the author to ensure behavior is intended or tested. The comment does not provide a specific suggestion or point out a specific issue with the code.
2. frontend/lib/sql/transpile.ts:74
- Draft comment:
Extracting WITH clause aliases looks good; verify that all CTE entries have the expected structure to avoid undefined values. - Reason this comment was not posted:
Confidence changes required:30%<= threshold50%None
3. frontend/lib/sql/transpile.ts:302
- Draft comment:
The additional check '!this.withAliases.has(mainTable)' ensures CTES alias are skipped for project_id filtering. Confirm this aligns with intended business logic. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to confirm if the additional check aligns with the intended business logic. This falls under asking the author to confirm their intention, which is against the rules. Therefore, this comment should be removed.
Workflow ID: wflow_UkDzTClCIgKzNDIW
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
| try { | ||
| this.parser.whiteListCheck(sqlQuery, | ||
| allowedTables, | ||
| [`(select)::(.*)::(${Array.from(this.allowedTables.union(this.withAliases)).join('|')})`], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'union' on Set is non-standard in JavaScript. Consider using 'new Set([...this.allowedTables, ...this.withAliases])' for compatibility.
| [`(select)::(.*)::(${Array.from(this.allowedTables.union(this.withAliases)).join('|')})`], | |
| [`(select)::(.*)::(${Array.from(new Set([...this.allowedTables, ...this.withAliases])).join('|')})`], |
frontend/lib/sql/transpile.ts
Outdated
| } | ||
| // Transpile the query | ||
| const transpiled = this.transpileQuery(ast, projectId); | ||
| console.log(transpiled.sql); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove or replace the console.log of transpiled SQL before production deployment.
| console.log(transpiled.sql); |
* estimate span size before any processing (#654) * Feat/lam 682 (#655) * feat: update delete project, fix spans filters * fix: rendering, model fallback * feat: move delete endpoint to next * feat: fix margins * feat: update delete project data in ch, fix comments * fix: command * feat: add debug console * feat: move helper function * allow CTES in SQL editor (#653) * allow CTES in SQL editor * remove debug console.log * fix reset usage when upgrading (#657) * Hotfix/ack browser events (#660) * first ack browser events, then increment usage * don't wait for async insert on browser events * feat: fix decode key by passing in docker file (#661) * feat: fix decode key by passing in docker file * feat: add key to full build --------- Co-authored-by: Dinmukhamed Mailibay <[email protected]>
Important
Allow CTEs in SQL editor by updating
SQLValidatorto track and handle CTE aliases.SQLValidator.validateAndTranspile().project_idconditions are not applied to CTEs inprocessSubqueries().withAliasesset toSQLValidatorto store CTE aliases.validateAndTranspile()to populatewithAliaseswith CTE names.processSubqueries()to skipproject_idapplication for CTEs.This description was created by
for 971b3cf. You can customize this summary. It will automatically update as commits are pushed.