In SQLAlchemy, ModelName.query.filter_by(field_name=value).count()
returns correct record count, but ModelName.query.filter_by(field_name=value).all()
only returns a single record. Doing a db.session.execute("SELECT * FROM table_name WHERE field_name = 'value'")
works fine. Has anybody faced a similar problem? Does anyone have any idea what could possibly be wrong. Any pointers will help.
Information that might be helpful
I am using MS SQL Server 2008 R2 and accessing it using FreeTDS/pyodbc. I do not control the database and can not change it.
Thanks in advance.