Attached is one I made using what it looks like the relationships are  
based on your test code.   It inserts 3502 rows into a SQLite database  
without issue.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

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

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

class Test(Base):
    __tablename__ = 'test'
    id = Column(Integer, primary_key=True)
    data = Column(String(50))
    
class Section(Base):
    __tablename__ = 'section'
    id = Column(Integer, primary_key=True)
    data = Column(String(50))
    test_id = Column(Integer, ForeignKey('test.id'))
    test = relation(Test, backref='sections')
    
class Question(Base):
    __tablename__ = 'question'
    id = Column(Integer, primary_key=True)
    data = Column(String(50))
    section_id = Column(Integer, ForeignKey('section.id'))
    section = relation(Section, backref='questions')
    
class Answer(Base):
    __tablename__ = 'answer'
    id = Column(Integer, primary_key=True)
    data = Column(String(50))
    question_id = Column(Integer, ForeignKey('question.id'))
    question = relation(Question, backref='answers')

Base.metadata.create_all(bind=engine)

sess = sessionmaker(bind=engine)()

test = Test(data='t1')
section = Section(data='s1')
section.test=test

for i in range(500):
  q=Question(data='q%d' % i)
  q.section=section
  for j in range(6):
      a = Answer(data='a %d %d' % (i, j))
      a.question = q

sess.save(test)
sess.commit()




On Jun 18, 2008, at 3:37 PM, Marin wrote:

>
>> cant really tell unless you provide a fully functional, as simple as
>> possible test case, preferably against sqlite, which can be run with
>> no dependencies.
>
> I'll try to make one. I tried to fix it doday and got that the next
> code does not produce the error:
> test = Test()
> section = Section()
> section.Test=test
> db_session.save(test)
> for i in range(60):
>    q=Question()
>    q.Section=section
>    for j in range(6)
>        a = Answer()
>        a.Question = q
>
> db_session.commit()
>
> Is there a max limit on the number of SQL commands that SA can isue
> between a BEGIN-COMMIT?
>
> --~--~---------~--~----~------------~-------~--~----~
> 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