7 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: One To Many Polymorp...| From | Sent On | Attachments |
|---|---|---|
| praddy | 24 Aug 2007 05:39 | |
| Gaetan de Menten | 24 Aug 2007 06:49 | |
| Pradeep Jindal | 24 Aug 2007 13:15 | |
| praddy | 27 Aug 2007 02:11 | |
| Michael Bayer | 27 Aug 2007 07:26 | |
| Pradeep Jindal | 27 Aug 2007 12:08 | |
| Pradeep Jindal | 28 Aug 2007 11:15 | .py |
| Subject: | [sqlalchemy] Re: One To Many Polymorphic Association.![]() |
|---|---|
| From: | praddy (prad...@gmail.com) |
| Date: | 08/27/2007 02:11:34 AM |
| List: | com.googlegroups.sqlalchemy |
Currently, unable to find any solution for this problem. I think my little knowledge with respect to sqlalchemy is restricting me to get a solution for this issue. Anyone with somewhat more in-depth knowledge should be able to find a solution.
Waiting...
Regards, Pradeep Jindal
On Aug 25, 1:15 am, Pradeep Jindal <prad...@gmail.com> wrote:
On Friday 24 August 2007 19:20:00 Gaetan de Menten wrote:
You might be interested by:http://techspot.zzzeek.org/?p=13 (also in the examples directory of SQLAlchemy)
On 8/24/07, praddy <prad...@gmail.com> wrote:
########################################################## from sqlalchemy import * meta = BoundMetaData('sqlite://', echo=False)
# Parents table. parents = Table('parents', meta, Column("id", Integer, primary_key=True), Column("data", String(50), nullable=False) )
# Children_1 Table. children_1 = Table('children_1', meta, Column("id", Integer, primary_key=True), Column("data", String(50), nullable=False) )
# Children_2 Table. children_2 = Table('children_2', meta, Column("id", Integer, primary_key=True), Column("data", String(50)) )
# Association Table. # This is a generic table which can relate anything to parent. assoc = Table('assoc', meta, # parents.c.id Column("parent_id", Integer, ForeignKey(parents.c.id)), # associate's id either children_1.c.id or children_2.c.id or any other child. Column("assoc_id", Integer), # Which can be either 'child_1' or 'child_2' for now (can be used for extending children # type, decides which table to look in. Column("assoc_type", String(20)) ) #######################################################
I am a novice with respect to sqlalchemy & may be RDBMS as well. How would you like to work on this scenario to achieve backwards cascading (may not be the right word) which means when one deletes one specific child from children_1 table (for example), there should not be any association entry, which associates that child to the parent, in the association table as well?
Thanks for the reply. I have already gone through that article, but was unable to figure out the solution. Anyways, I will give it one more try. Please note that this scenario is already there and I can't make any changes to the tables at all.
Thanks - Pradeep Jindal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---





.py