# sqlalchemy.exc.ProgrammingError: (psycopg2.errors.SyntaxError) syntax error at or near "and"

- **ID:** `python/sqlalchemy-invalid-boolean-filter`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Incorrectly combining filter conditions using Python 'and' instead of SQLAlchemy's and_() function.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   from sqlalchemy import and_
result = session.query(User).filter(and_(User.age > 18, User.active == True)).all()
   ```
2. **** (90% success)
   ```
   result = session.query(User).filter(User.age > 18).filter(User.active == True).all()
   ```

## Dead Ends

- **** — May work for some cases but can cause operator precedence issues. (40% fail)
- **** — SQLAlchemy may interpret incorrectly. (50% fail)
