Re: [sqlalchemy] Learning to use new PG Ranges

2022-11-26 Thread Mike Bayer
well this fixes for now tusage = session.execute( select(func.sum(Usage.used_amount)) .where(Usage.date.op('<@')(cast(ccontract.validity, DATERANGE.scalar_one() otherwise what is happening is Usage.date.op(...)(Range(...)) doesn't have any way at the moment to know what

[sqlalchemy] Learning to use new PG Ranges

2022-11-26 Thread Lele Gaifax
Hi, now and then I'm spending some time migrating one app from SA v1.4 to v2: most of the porting problems stem from the new PG Range class, and today I hit the following, that I'm not sure how I should fix. This script is a contrived example, reducing the real code down to the essential: fr