Reputation: 331
How to query non-model views or table returning functions with Ecto? In my case the function (taking one argument) returns the same columns as one of my models and would just need to be read only.
Upvotes: 3
Views: 83
Reputation: 51429
You can tell Ecto to load data from any view or table as follows:
from c in "special_comments(1)"
If you want to load that into a particular module, you can do:
from c in {"special_comments(1)", MyApp.Comment}
And you should be good to go!
Upvotes: 2