Two great questions!
First one comes down to how database query optimization and predicate pushdown in particular. In this case, albums would probably have an index on albums.id column, which would optimize get_album_by_id into a single index lookup. Ideally, I would want to have an explicit function for this, something like sql::from_index("albums", "id", 3), but there is no such thing as explicit index lookup in PostgreSQL right now.
Regarding different function syntaxes:
- curly braces
{ ... }construct a new tuple (think object, struct, record), - parenthesis are used for precedence. They are not strictly needed for function bodies, but they do give a better visual guide to multi-line definitions, especially when using pipe operator.
So:
func something() -> { ... } # constructs a new tuple
func something() -> ( ... ) # returns a value
func something() -> ... # equivalent to ( ... )
I do believe that it is possible to translate any SQL query to Lutra, that is Lutra can cover that last 1% of cases. There are a few caveats: