Skip to content

Commit 4a058ec

Browse files
committed
fix(tests): sqlalchemy.exc.ArgumentError
* Textual SQL expression 'SELECT setval(pg_get_seri...' should be explicitly declared as text('SELECT setval(pg_get_seri...') * unclear why this doesn't popped up before. it should have!
1 parent 84f2d78 commit 4a058ec

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

invenio_pidstore/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import six
1919
from invenio_db import db
2020
from invenio_i18n import lazy_gettext as _
21-
from sqlalchemy import func
21+
from sqlalchemy import func, text
2222
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
2323
from sqlalchemy.orm.exc import NoResultFound
2424
from sqlalchemy_utils.types import ChoiceType, UUIDType
@@ -608,8 +608,9 @@ def _set_sequence(cls, val):
608608
"""
609609
if db.engine.dialect.name == "postgresql": # pragma: no cover
610610
db.session.execute(
611-
"SELECT setval(pg_get_serial_sequence("
612-
"'{0}', 'recid'), :newval)".format(cls.__tablename__),
611+
text(
612+
f"SELECT setval(pg_get_serial_sequence('{cls.__tablename__}', 'recid'), :newval)"
613+
),
613614
dict(newval=val),
614615
)
615616

0 commit comments

Comments
 (0)