# sqlalchemy.exc.ArgumentError: Relationship X.y could not determine any unambiguous local/remote column pairs for this relationship. Please provide the 'foreign_keys' argument.

- **ID:** `python/sqlalchemy-invalid-relationship-direction`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

关系定义中缺少外键指定，ORM 无法判断哪列是外键。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.4.x | active | — | — |
| 2.0.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   在 relationship 中明确指定 foreign_keys，例如：items = relationship('Item', foreign_keys='Item.order_id')
   ```
2. **** (85% success)
   ```
   在模型的外键列上使用 ForeignKey 约束，并确保关系定义正确。
   ```

## Dead Ends

- **** — 在 relationship 中只添加 primaryjoin，但未指定 foreign_keys，仍然报错。 (70% fail)
- **** — 尝试删除关系定义，但业务代码需要该关系进行查询。 (60% fail)
