Closed tanj closed 3 years ago
Thank you for the detailed report! I have a couple more questions:
NULLS FIRST
flask-sqlalchemy: 2.5.1 DB is postgres
Thank you. I see that queries are different, and know how to disable that. But I'm trying to build a test case that will catch that, and so far both queries give me correct number of relationships in the API response.
Is there specific scenario when you get incorrect result? Is it in relationship or in include? and what is minimum required entities in db to reproduce?
I was able to reproduce, will release a fix soon
Could you please try v2.2.5 ?
Thank you! You got that sorted so quickly! I really appreciate your responsiveness.
I can confirm that the fix works.
Is there specific scenario when you get incorrect result? Is it in relationship or in include?
It is in the relationship itself. No include is needed. It is present in all queries.
what is minimum required entities in db to reproduce?
I can provide example data from my database if you still need it, but sounds like you were able to create a test case.
Thank you for the confirmation! Yes, I was able to create a test case that reproduces it
I've got a relationship where I use the
secondary
clause to set the correct sort order. Flask Restless NG v 2.2.4 generates an incorrect query to build the relationship. The incorrect query results in 237 records, while the correct query (expected query) returns 53 records. If I remove thesecondary
andorder_by
I get the correct number of records, but not sorted.Incorrect query
Expected query
Query with
secondary
andorder_by
removedQuery
sqlalchemy
generates when accessing the relationship withsecondary
andorder_by
Models (simplied to just show relationships)
TTestsheet
TReport
TDevice
System Details
Python: 3.8.10 flask: 2.0.1 SQLAlchemy: 1.4.22 flask-restless-ng: 2.2.4