Hi All,

I have the following models:

class IP(Base):
    __tablename__ = 'ip'
    username = Column(String(50),
                      ForeignKey('user.username'),
                      primary_key=True)
    ip = Column(String(15), primary_key=True, index=True)

class User(Base):
    __tablename__ = 'user'
    username = Column(String(50), primary_key=True)
    ips = relation("IP",
                   order_by="IP.ip",
                   backref="user",
                   cascade="all")

If I delete a user as follows:

session.delete(session.query(User).get('testname'))

...then the IPs associated with 'testname' get deleted.

However, if I do:

session.query(User).delete()

..they do not.

Why is that?
How do I get them both to work?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
           - http://www.simplistix.co.uk

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to