Unfortunately,  without an illustration of your usage pattern, we  
can't assist with your issue.    Here's the same test case again from  
earlier in the thread.  Can you modify it to look like your failing  
condition ?

rom sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('sqlite://', echo=True)
Base = declarative_base()

class PublicationElement(Base):
     __tablename__ = 'publication'
     publication_id = Column(Integer, primary_key=True)
     name = Column(Unicode(255))


class SectionElement(Base):
     __tablename__ = 'section'
     section_id = Column(Integer, primary_key=True)
     publication_id = Column(Integer,
ForeignKey('publication.publication_id'), nullable=False)
     publication = relation('PublicationElement', cascade="all, delete-
orphan", backref='sections')
     name = Column(Unicode(255))


Base.metadata.create_all(engine)

Session = sessionmaker(bind=engine)

sec1 = SectionElement(name='s1',
publication=PublicationElement(name='p1'))
sess = Session()
sess.add(sec1)
sess.commit()

assert sess.query(SectionElement).one().publication.name == 'p1'

sess.delete(sec1)
sess.commit()

assert engine.execute("select count(1) from publication").scalar() == 0
assert engine.execute("select count(1) from section").scalar() == 0


On Aug 29, 2008, at 1:44 AM, Michael Brickenstein wrote:

>
> Hi!
> Hi have a similar problem using
> table reflection a la sqlsoup. My DB Backend ist postgresql 8.3.
>
> I have a many to many relation:
> orms5=# \d project_programming_language
>  Table "public.project_programming_language"
>         Column          |  Type   | Modifiers
> -------------------------+---------+-----------
> project_id              | integer | not null
> programming_language_id | integer | not null
> Indexes:
>    "projprogpkconstraint" PRIMARY KEY, btree (project_id,
> programming_language_id)
> Foreign-key constraints:
>    "programmierspracheconstraint" FOREIGN KEY
> (programming_language_id) REFERENCES
> programming_language(programming_language_id) ON DELETE CASCADE
>    "projektconstraint" FOREIGN KEY (project_id) REFERENCES
> project(project_id) ON DELETE CASCADE
>
> I got the same message, when delete an object of the table
> programming_language:
>
> Dependency rule tried
> to blank-out primary key column
>
> As you can see, the foreign key constraints in the db work fine:
> I can drop the row via a
> DELETE
> statement in sql.
>
> Michael
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to