# sqlalchemy.exc.FlushError: Instance <Child at 0x...> has a NULL identity key.  If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured correctly.

- **ID:** `python/sqlalchemy-relationship-delete-orphan-without-cascade`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Trying to delete a child object that is not properly associated or has missing primary key, often due to missing cascade delete-orphan.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   class Parent(Base):
    children = relationship('Child', cascade='all, delete-orphan')
# Then remove child: parent.children.remove(child)
   ```
2. **** (80% success)
   ```
   session.delete(child)
session.commit()
   ```

## Dead Ends

- **** — May conflict with auto-increment; not scalable. (50% fail)
- **** — The child still exists in session and gets flushed. (70% fail)
