CodeBench: code-small — ForeignKey importin tarkennus (sqlalchemy, ei .orm)
8b importtaa ForeignKey väärästä paikasta (sqlalchemy.orm). Lisätty eksplisiittinen "NOT from sqlalchemy.orm!" -varoitus.
This commit is contained in:
@@ -17,7 +17,7 @@ Key patterns (copy from reference):
|
|||||||
|
|
||||||
FOREIGN KEYS (when spec has relationships):
|
FOREIGN KEYS (when spec has relationships):
|
||||||
- Child entity gets parent_id field: Mapped[int] = mapped_column(ForeignKey("parents.id"))
|
- Child entity gets parent_id field: Mapped[int] = mapped_column(ForeignKey("parents.id"))
|
||||||
- Import ForeignKey: from sqlalchemy import ForeignKey
|
- Import: from sqlalchemy import ForeignKey (NOT from sqlalchemy.orm!)
|
||||||
- Create schema includes parent_id: int
|
- Create schema includes parent_id: int
|
||||||
- Test creates parent FIRST, then child with parent's id
|
- Test creates parent FIRST, then child with parent's id
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user