7 ms·
What would be cool is "take this view with N columns, and add back in these other Y columns that were projected away" or "add/remove/modify these columns from t
by tbrownaw 4y ago
What would be cool is "take this view with N columns, and add back in these other Y columns that were projected away" or "add/remove/modify these columns from the source table while preserving whatever others there may be".
- aerzen 4y agoYou mean join back with original table?
- tbrownaw 4y agoThat's the current solution, but the issue is that the query optimizer can't always handle being tortured like that.
- snthpy 4y agoWhat you are describing sounds like the `derive` transform in PRQL: it allows you to add new columns based on existing columns you already have. See [0]. Of course this is mostly also possible in SQL but PRQL makes this a bit nicer in that 1) `derive` makes it explicit that you'll be only adding columns and not projecting any away, and 2) you can refer to the newly created fields straight away. [0]: https://prql-lang.org/book/transforms/derive.html https://prql-lang.org/book/transforms/derive.html