evidence icon indicating copy to clipboard operation
evidence copied to clipboard

[Bug]: query casing is not respected for file queries and aliases

Open kennan-simpliphy opened this issue 1 year ago • 1 comments

Describe the bug

---
queries:
  - releaseYear: release_year.sql
---

vs

---
queries:
  - my_alternative_alias: release_year.sql
---

If you alias release_year.sql as releaseYear, the frontmatter will run without error and a query named releaseyear (lowercase 'y') will run successfully. But there will not be a query named releaseYear (capital 'y') in the scope, and any downstream attempts to reference it as such will fail.

While the examples in the docs use snakecase, I don't believe anywhere in the docs indicates that camelCase aliases will cause this particular bug.

Severity

annoyance

Additional Information, or Workarounds

No response

kennan-simpliphy avatar Dec 16 '24 04:12 kennan-simpliphy

I've looked back into the PR where this feature was implemented.

https://github.com/evidence-dev/evidence/pull/734

We intentionally decided to lowercase all query ids because of unexpected behaviour if you used mixed cases. Solution is therefore

  1. Better docs - document this behaviour
  2. And ideally - throw useful warning if user tries to use capital letters in a query ID

or better yet

  1. Fix this behaviour

archiewood avatar Dec 17 '24 02:12 archiewood