On Thu, Oct 10, 2019, at 3:53 AM, 'Marc Vegetti' via sqlalchemy wrote:
> Hello, first of all, thnak you for your fast answer.
> 
> I was refering to : 
>> A database level `ON DELETE` cascade is configured effectively on the 
>> *many-to-one* side of the relationship; that is, we configure it relative to 
>> the `FOREIGN KEY` constraint that is the “many” side of a relationship. At 
>> the ORM level, *this direction is reversed*. SQLAlchemy handles the deletion 
>> of “child” objects relative to a “parent” from the “parent” side, which 
>> means that `delete` and `delete-orphan` cascade are configured on the 
>> *one-to-many* side


so this documentation is only referring to the conceptual difference between 
how SQLAlchemy deals with collections, that is it starts with the parent object 
that has the collection and deals with the contents as the "child" objects, so 
that's where the "cascade" is set, but in the relational database, the 
"cascade" is part of the foreign key which is configured in terms of the child 
rows that refer back to the parent row. that is, the database doesn't really 
know about a "collection" as much as it knows about rows that point to other 
rows. the ORM applies a higher level concept to that, that's all.




> 
> Marc V. 
> 

> --
>  SQLAlchemy - 
>  The Python SQL Toolkit and Object Relational Mapper
> 
> http://www.sqlalchemy.org/
> 
>  To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
>  --- 
>  You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
>  To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/8a5b9f82-e20a-4bb7-a7cc-eeb6c87d6719%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/8a5b9f82-e20a-4bb7-a7cc-eeb6c87d6719%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/3933d64b-8762-4e94-b52b-cca687a7e617%40www.fastmail.com.

Reply via email to