This is probably not gonna be helpful, but... have you tried using an
ORM that isn't inherently broken, for example Sequel? I've used it
once for interfacing with external database and had no problems
setting up a join across eight tables with variously named fields. I
can post bits of my code if you wish.

-- Matma Rex