# sqlalchemy.exc.ArgumentError: Foreign key 'orders.user_id' column type 'VARCHAR' does not match referenced column 'users.id' type 'INTEGER'

- **ID:** `python/sqlalchemy-invalid-foreign-key-column-type`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The foreign key column has a different data type than the primary key it references, causing database-level type mismatch.

## Version Compatibility

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

## Workarounds

1. **** (100% success)
   ```
   class User(Base):
    id = Column(Integer, primary_key=True)
class Order(Base):
    user_id = Column(Integer, ForeignKey('users.id'))  # not String
   ```

## Dead Ends

- **** — May break other relationships or data integrity. (50% fail)
- **** — Database may reject inserts or cause performance issues. (70% fail)
