Split db, sql, and table into separate modules