ucam-department-of-psychiatry / camcops

Cambridge Cognitive and Psychiatric Test Kit (CamCOPS)
Other
12 stars 8 forks source link

Remove invalid assertion following SQLAlchemy 1.4 upgrade #326

Closed martinburchell closed 6 months ago

martinburchell commented 6 months ago

I missed this when upgrading to SQL Alchemy 1.4

Since SQLAlchemy 1.4, the return value from Session.execute() is now a CursorResult object and the type of CursorResult.inserted_primary_key is now a tuple, not a list.

@RudolfCardinal the assert was added in 04599ca928a5d66da732598c55503986abda18da. I don't suppose you remember why? I suppose we could keep the len(inserted_pks) == 1 if we wanted.

Old docs: https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.ResultProxy.inserted_primary_key New docs: https://docs.sqlalchemy.org/en/14/core/connections.html#sqlalchemy.engine.CursorResult.inserted_primary_key

RudolfCardinal commented 6 months ago

Have commented -- yes, likely a duff previous assert! Thank you!