There is currently limited connection support in persistent, and I believe this is only SQL.
I have several helpers that I use for simple cases. They can be found here . This is not true JOIN, it selects once for the table, and then builds a list of tuples representing the "connected" rows with the element from each.
Given your models and this helper, you should do something like:
records <- runDB $ do sessions <- selectList [] [] players <- selectList [] [] tables <- selectList [] [] return $ joinTables3 gamingSessionPlayer gamingSessionTable sessions players tables forM records $ \(session, player, table) -> do -- -- ... --
Only those cases where a record exists in all three tables will be returned (this is an INNER JOIN), but you can also pre-filter the performance.
pbrisbin
source share