# sqlalchemy.exc.InvalidRequestError: Table 'users' is already defined for this MetaData instance.  Specify 'extend_existing=True' to redefine options and columns on an existing Table object.

- **ID:** `python/sqlalchemy-missing-schema-qualified-table`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Multiple Table definitions with the same name in the same MetaData without extend_existing, often caused by model imports or metadata reuse in tests.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   # models.py
from sqlalchemy import MetaData, Table, Column, Integer
metadata = MetaData()
users = Table('users', metadata, Column('id', Integer), extend_existing=True)
# import only once via from models import metadata
   ```
2. **** (85% success)
   ```
   from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
   ```

## Dead Ends

- **** — Hides the root cause (duplicate definitions) and can lead to inconsistent schemas if columns differ. (40% fail)
- **** — Breaks relationships between models if they share a MetaData; causes new errors in foreign key resolution. (70% fail)
