sqlalchemy: fix wrong assertion and make the safeguards in the case of array of primitives stored in sql table more consistent