metabase / macaw

A Clojure wrapper for JSqlParser 🦜
Eclipse Public License 1.0
6 stars 1 forks source link

Generate stable scope IDs #66

Closed crisptrutski closed 3 months ago

crisptrutski commented 3 months ago

Currently Macaw uses a global counter to assign

Ideally we would have a deterministic assignment for a given query, and has some local stability where things don't change in a query.

  1. A very simple idea that satisfies determinism would be to simply reset the counter every time we do analysis.
  2. We could get a bit more stability through per-query counters based on hashing the context, added to that hash.
  3. If we see value in the "invalidation" behavior, we could add a hash of the string contents of each scope to this number.

We don't need to preserve global uniqueness across queries, as we can always pair these ids with a card id in Metabase.

crisptrutski commented 3 months ago

This will be good enough for now IMHO