Paul's Programming Notes
PostsRSSGithub

NULL values excluded from NOT IN - SQLAlchemy+SQLite

26 Nov 2014

Solution: AND column IS NOT NULL

Example: query.filter(or_(~self.column.in_(value), self.column == None))

This thread explains “SQL Server in treating NULL as a value”: http://stackoverflow.com/questions/11491831/null-values-are-excluded-why

pythonsqlalchemysql-server

Related posts

  • SQLAlchemy Performance Tip 03 Sep 2014
  • Alembic Cheat Sheet - Python/SQLAlchemy 27 Aug 2014
  • Use List In Bind Parameters - SQLAlchemy 01 Aug 2014
© 2026. All rights reserved.