Most queries in Ecto are written using schemas. To retrieve all users from a database for example: MyApp.Repo.all(User) As Ecto knows all the fields that a schema has, it is simple to use: query = from p in Post, select: %Post{title: p.title, body: p.body} MyApp.Repo.all(query)