Re: [sqlalchemy] Clarification about performance and relation()

2010-03-26 Thread masetto
Excuse me, After your valuable advice, i've modified my code and i've removed the manual setting of the foreign key (which was completely wrong). But now i've another problem, maybe due to another misunderstanding. (I've moved all my ORM classes within the same module now). I am parsing an xml

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-26 Thread werner
Hi Masetto, On 26/03/2010 16:01, masetto wrote: Maybe it's a stupid problem but i can't figure it out at the moment :/ Code: ... for definitions in ovalXML._childrenMap['definitions']: for definition in definitions.getchildren(): defInst =

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-26 Thread masetto
First of all, thanks for your answer :) # defInst.PlatformRel = [platf]# change this to platf.definitions = defInst I don't have any definitions attribute within the PlatformClass, i suppose you mean the foreign key, isnt'it? That is platf.platformId_fk = defInst However, this results in

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-26 Thread Michael Bayer
masetto wrote: defInst.PlatformRel = [platf] dont you mean to be appending here ? definst.platformrel.append(platf) session.add(defInst) session.add(platf) #i perform a commit every 1000 definitions as you suggested :)

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-26 Thread werner
Hi Masetto, On 26/03/2010 17:43, masetto wrote: First of all, thanks for your answer :) You are welcome. # defInst.PlatformRel = [platf]# change this to platf.definitions = defInst I don't have any definitions attribute within the PlatformClass, i suppose you mean the foreign key,

[sqlalchemy] Clarification about performance and relation()

2010-03-25 Thread masetto
Hi all, i am writing a python script which parse an xml file (python lxml) and import it into a sqlite db, and it works. The xml file size is about 30Mb and the import operation takes about 15 minutes (do you think is too much? is there something i can do to speed up the process?) This is a

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-25 Thread Michael Bayer
masetto wrote: Hi all, i am writing a python script which parse an xml file (python lxml) and import it into a sqlite db, and it works. The xml file size is about 30Mb and the import operation takes about 15 minutes (do you think is too much? is there something i can do to speed up the

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-25 Thread masetto
From 30 mins to 2mins... shame :P Thanks Micheal ! Forgive me, what about the other question about foreign keys? On Thu, Mar 25, 2010 at 3:43 PM, Michael Bayer mike...@zzzcomputing.comwrote: masetto wrote: Hi all, i am writing a python script which parse an xml file (python lxml) and

Re: [sqlalchemy] Clarification about performance and relation()

2010-03-25 Thread Michael Bayer
the relationship between two tables requires both the ForeignKey to be present as well as the relationship() (relation() in 0.5) function to be present in the mapping. masetto wrote: From 30 mins to 2mins... shame :P Thanks Micheal ! Forgive me, what about the other question about foreign