Skip to content

v0.6.5: Better reuse of column definitions in other columns

Choose a tag to compare

@ZmeiGorynych ZmeiGorynych released this 14 May 10:21
· 321 commits to main since this release
83784af

SLayer 0.6.5

A small quality-of-life release for people writing model SQL.

What's new

You can now use a sibling column's short name inside another column's SQL on the same model. Previously you had to write the fully qualified <model>.<col> form; both forms now work the same way. So if bucket is a derived column on orders, you can write either orders.bucket or just bucket in another column's SQL and it will inline correctly. Bare names inside sub-queries, UNION branches, CTEs, and VALUES are left alone, since those refer to the inner rowset rather than your model.

If you accidentally write circular references between columns (column A depends on B, B depends on A), SLayer now catches this when you save the model instead of letting it fail later at query time. The error tells you the exact cycle path. Existing data with cycles still loads fine, so you can clean it up at your own pace.

For maintainers
  • New exception slayer.core.errors.ColumnCycleError (multi-inherits SlayerError and ValueError so except ValueError call sites keep working).
  • StorageBackend.save_model is now a template method that runs the cycle validator before delegating to a backend-specific _save_model_impl.
  • Migration write-back skips cycle validation, so legacy cyclic models remain loadable.