Skip to content

Conversation

max-sixty
Copy link
Member

No description provided.

@max-sixty
Copy link
Member Author

max-sixty commented Jul 2, 2022

Would close #721. I need to add to the docs.

I had previously implemented an rs"foo" string. But actually I think the double-bracket approach is fairly standard, and more closely aligns with the current problem. Definitely open to feedback though.

@max-sixty
Copy link
Member Author

max-sixty commented Jul 3, 2022

Currently the SQL formatter is changing {?foo} to ( ? foo }. I need to think about the best way of dealing with this — is there some generalized way (i.e. all valid across dialects) of surrounding the expression so that the SQL formatter doesn't mangle it, but it's still valid?

Otherwise we'll have to replace it with something and then swap it back after the formatting, which would be a bit inelegant.

@max-sixty
Copy link
Member Author

Possibly the way to do this is to surround double-bracket strings with dialect-specific "quotes" — e.g. for MySQL & BigQuery, we use backticks; for others we use double-quotes.

I can't see an escape hatch like we do for jinja expressions (https://github.com/prql/prql/blob/0.2.0/prql-compiler/src/sql/translator.rs#L46).

@mklopets
Copy link
Collaborator

mklopets commented Jul 8, 2022

Currently the SQL formatter is changing {?foo} to ( ? foo }

fyi, just as a related data point, our PRQL pipeline already does this kind of replacing post-compilation as we use postgres's @? inside of an S-string, which gets mangled to @ ? (i.e. invalid sql)

@max-sixty
Copy link
Member Author

Thanks for that case @mklopets

I increasingly think we should parse to some representation of "raw ident", e.g. backticks, and then based on the dialect convert to either backticks or double-quotes.

@max-sixty
Copy link
Member Author

max-sixty commented Jul 18, 2022

I increasingly think we should parse to some representation of "raw ident", e.g. backticks, and then based on the dialect convert to either backticks or double-quotes.

I'm planning to pursue this, combined with the approach in #809.

So:

from foo
select `{{bar}}`

becomes, for dialects that use double-quotes to surround "raw identifiers":

select "{bar}" from foo

or for those that use backticks:

select `{bar}` from foo

The only change here would be to compile {{bar}} into {bar} — i.e. double brackets become single brackets with no evaluation of the contained expression. Currently is an error since it attempts to evaluate {bar} as a PRQL expression.


Edit: for any future travelers, I didn't end up pursuing this exact approach — the s-string approach seems to cover the cases, with fewer additional language features.

@max-sixty max-sixty mentioned this pull request Jul 18, 2022
max-sixty and others added 14 commits July 29, 2022 11:11
* Remove unnecessary steps from GHAs
As dscribed in the comment, not worth the extra time to pin the version
* Add section to contributing explaining our tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* .

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* rename java test package name

* cross try

* release conf

* fix tests

* update doc

* profile adjustment

* pre-commit

* update developers

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 1 to 3.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v1...v3)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Improve GHA caching

Swap out actions-rs for @baptiste0928 crate

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Now we no longer have the playground, no need to use wasm to test the book
Removing this because it generates a 404, as per #818.

Is there a way to link to a section on the homepage? Linking to prql-lang.org/index.html#Bindings doesn't seem to work either.
…#817)

Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 14.2.3 to 14.2.5.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](testing-library/user-event@v14.2.3...v14.2.5)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* docs: link to list of bindings from faq

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* avoid setting empty id for most sections

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
max-sixty and others added 22 commits July 29, 2022 11:11
* Fix python releaes workflow

Really we should have a test release workflow running which does a dry-run, so we don't get these sorts of problems (which I'm sure was my fault tbc...)
* Adding row_number_id to ROW_NUMBER() SQL to make them unique

* Adding tests for #826

* Fixing clippy

* Testing raw flag to pass the deadlinks check

* Apply suggestions from code review

Try reverting raw link change

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
* Only run check-links on modified files

And then run every day on all. This should reduce the issues we had in #853, not the first time we've had them.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Only install wasm-pack in CI when needed

GHA builds are getting longer now, we're well past our 1 minute target...

Though this isn't going to help much!
* Add some workflows to track our compilation time

It's getting quite long now — CI jobs take 90-150 seconds, almost all of
which is compilation, even with a cache.

Locally I'm seeing more like 20s after wiping `target`.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* .

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* .

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Busts cache so #860 will cache correctly
* Remove cached cargo-timings files in GHA
Another cache bust, this time for #864
Weirdly the book printed an error, but passed?!
https://github.com/prql/prql/runs/7530558870?check_suite_focus=true

(this was from #1513, zero stress tbc)
* Fix BigQuery quoting

Not sure this will be the end of it, but progress

* .
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/commits)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Guessing this was an oversight
* Switch implicit `compile` tests to actual `compile` tests
Bumps [wasm-react-scripts](https://github.com/Cosmian/create-react-app/tree/HEAD/packages/react-scripts) from 5.0.2 to 5.0.3.
- [Release notes](https://github.com/Cosmian/create-react-app/releases)
- [Changelog](https://github.com/Cosmian/create-react-app/blob/main/CHANGELOG-1.x.md)
- [Commits](https://github.com/Cosmian/create-react-app/commits/react-error-overlay@5.0.3/packages/react-scripts)

---
updated-dependencies:
- dependency-name: wasm-react-scripts
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@max-sixty
Copy link
Member Author

Not sure what's going on with the commit history but it'll be squashed...

Added some docs too; lmk if anything is unclear!

@max-sixty max-sixty enabled auto-merge (squash) July 29, 2022 20:29
@max-sixty max-sixty merged commit e3aa960 into main Jul 29, 2022
@max-sixty max-sixty deleted the double-brackets branch July 29, 2022 20:31
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.

6 participants