Sorts generated output by key
Fix set_id function to join only tuples
Fix SQLAlchemy ORM model generating