# sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: users

- **ID:** `python/flask-database-connection-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The database table does not exist, often because the models were not created or the database file is missing.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   Run db.create_all() after importing all models: from app import db\nfrom models import User\ndb.create_all()
   ```
2. **** (90% success)
   ```
   Use Flask-Migrate to manage database schema: flask db upgrade
   ```

## Dead Ends

- **** — Creating the table in a different database file does not help if the connection string is wrong. (60% fail)
- **** — Using db.create_all() only works if the models are imported correctly. (70% fail)
