Skip to content

feat: validation now works for templated query - #1119

Merged
czgu merged 3 commits into
pinterest:masterfrom
czgu:lintfix
Jan 6, 2023
Merged

czgu merged 3 commits into
pinterest:masterfrom
czgu:lintfix

Conversation

@czgu

@czgu czgu commented Jan 6, 2023 •

Copy link
Copy Markdown
Collaborator
  • fixed an issue where templated_variables kept getting regenerated
  • make templated queries also get validated
  • make templated query render modal also show validation errors with highlights
    image

@czgu
czgu requested a review from jczhong84 January 6, 2023 02:25
@czgu
czgu marked this pull request as ready for review January 6, 2023 02:25
ILinterWarning,
TableToken,
} from 'lib/sql-helper/sql-lexer';
import { isQueryUsingTemplating } from 'lib/templated-query/validation';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this util function is only used in this file. As it's not needed here, it can be deleted.


const { validationErrorHighlights, queryValidationErrors, isValidating } =
useValidateQuery(
renderedQuery,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 2 api calls here, I'm wondering if it'll be better to have the renderTemplatedQuery api to accept another parameter to indicate if it should also do the validation on the rendered query and return the validation result along with the rendered query?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm I don't want to tie the two API calls together too much. One is for rendering the template and the other is to do validation check (only if the validator is configured). Also in future, I am thinking that we can make template rendering different if it is for validation so that we can map back the validation result from rendered query to unrendered query

@czgu
czgu merged commit 155baca into pinterest:master Jan 6, 2023
@czgu
czgu deleted the lintfix branch January 6, 2023 21:22
rohan-sh1 pushed a commit to CAI-TECHNOLOGIES/cai-ext-db-explorer that referenced this pull request Feb 28, 2023
* feat: validation now works for templated query

* remove isQueryUsingTemplating
aidenprice pushed a commit to arrowtail-precision/querybook that referenced this pull request Jan 3, 2024
* feat: validation now works for templated query

* remove isQueryUsingTemplating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants