# sqlalchemy.exc.CompileError: Cannot compile MySQL statement for PostgreSQL dialect

- **ID:** `python/sqlalchemy-exc-unsupported-compilation-error`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using database-specific SQL constructs (e.g., MySQL functions) with a different database backend that does not support them.

## Version Compatibility

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

## Workarounds

1. **Use generic SQLAlchemy functions** (90% success)
   ```
   Use SQLAlchemy's generic functions like func.now() instead of MySQL-specific NOW().
   ```
2. **Use compatible backend** (85% success)
   ```
   Switch to a compatible database backend or use database-specific dialects with proper abstraction.
   ```

## Dead Ends

- **Changing dialect only** —  (60% fail)
- **Using raw SQL blindly** —  (50% fail)
