Hi,
We have a use case where users should be able to define their own models which are stored at runtime in a generated database. To query these models we want to generate queries using Ecto, but we stumbled on a problem that bindings are evaluated on compile time.
Therefore the following, won’t compile:
root_table = "root"
root_name = :root
assoc_table = "associated"
assoc_name = :assoc_1
query = from(r in root_table, as: ^root_name)
|> join(:left, [{root_name, r}], a in ^assoc_table, on: field(r, :id) == field(a, :assoc_id), as: ^assoc_name)
However as our schema is not yet known at compile time we cannot provide these bindings. Are we reaching the limit of what you are able to do with ecto, or are there other routes we could explore?