evidence icon indicating copy to clipboard operation
evidence copied to clipboard

fix: remove comments and trailing `;` in sql query

Open AyushAgrawal-A2 opened this issue 1 year ago • 9 comments

Description

closes #733 closes #1735 closes #1450

Changes:

  • Remove single / multiline comments in query.
  • Remove trailing ; in query.
  • Completes TODO of QueryStore and fixes bug in chained query due to trailing ;.

Before: image

After: image

Checklist

  • [ ] For UI or styling changes, I have added a screenshot or gif showing before & after
  • [x] I have added a changeset
  • [ ] I have added to the docs where applicable
  • [ ] I have added to the VS Code extension where applicable

AyushAgrawal-A2 avatar Apr 13 '24 16:04 AyushAgrawal-A2

🦋 Changeset detected

Latest commit: fcab370a252a5b1f1393a473f96c9155ead01b93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@evidence-dev/preprocess Patch
@evidence-dev/sdk Patch
@evidence-dev/evidence Patch
@evidence-dev/components Patch
@evidence-dev/component-utilities Patch
@evidence-dev/core-components Patch
my-evidence-project Patch
evidence-test-environment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Apr 13 '24 16:04 changeset-bot[bot]

Deploy Preview for evidence-development-workspace ready!

Name Link
Latest commit fcab370a252a5b1f1393a473f96c9155ead01b93
Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/666706d4570572000861451c
Deploy Preview https://deploy-preview-1887--evidence-development-workspace.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 13 '24 16:04 netlify[bot]

Deploy Preview for next-docs-evidence ready!

Name Link
Latest commit fcab370a252a5b1f1393a473f96c9155ead01b93
Latest deploy log https://app.netlify.com/sites/next-docs-evidence/deploys/666706d44fe719000892f8ec
Deploy Preview https://deploy-preview-1887--next-docs-evidence.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 13 '24 16:04 netlify[bot]

Thanks for the PR!

One concern: seems like queries with string-enclosed "comments" are also caught here, which could be an issue if it's used as a delimiter or such in a string input (i.e. New York -- NY)

csjh avatar Apr 17 '24 17:04 csjh

@csjh Sorry, I missed that edge case. Tackling this requires parsing the query, I don't think it can be done via simple regex replace. I have added a helper function to do so.

This is required in 3 packages. In order to avoid cross package dependencies I have added this in all three packages. But I don't believe duplicate code is good. Please suggest if there is a common place to place this function. I tried placing it in db-commons but it create a cyclic dependency betweet QueryStore and db-commons.

Before: image

After: image

AyushAgrawal-A2 avatar Apr 18 '24 13:04 AyushAgrawal-A2

This is required in 3 packages. In order to avoid cross package dependencies I have added this in all three packages. But I don't believe duplicate code is good. Please suggest if there is a common place to place this function. I tried placing it in db-commons but it create a cyclic dependency betweet QueryStore and db-commons.

This should only be used in the query-store (which is now sdk/usql/query.js), and that should cover the impacted area

ItsMeBrianD avatar May 16 '24 15:05 ItsMeBrianD

Deploy Preview for evidence-test-env ready!

Name Link
Latest commit fcab370a252a5b1f1393a473f96c9155ead01b93
Latest deploy log https://app.netlify.com/sites/evidence-test-env/deploys/666706d4cb10130008870177
Deploy Preview https://deploy-preview-1887--evidence-test-env.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar May 16 '24 22:05 netlify[bot]

This is required in 3 packages. In order to avoid cross package dependencies I have added this in all three packages. But I don't believe duplicate code is good. Please suggest if there is a common place to place this function. I tried placing it in db-commons but it create a cyclic dependency betweet QueryStore and db-commons.

This should only be used in the query-store (which is now sdk/usql/query.js), and that should cover the impacted area

@ItsMeBrianD Done image

AyushAgrawal-A2 avatar May 16 '24 22:05 AyushAgrawal-A2

This is ready to be merged, but going to hold off until after the release so there is a testing window on next, thanks for the contribution!

ItsMeBrianD avatar May 17 '24 18:05 ItsMeBrianD

This is addressed in #2103

ItsMeBrianD avatar Jun 13 '24 16:06 ItsMeBrianD