Coerce keys to table types before creating read SQL

fixes #4