[sqlalchemy] Re: session issues in TG - automatic commits happening.

2007-06-26 Thread Sanjay
As I recall, this was discussed in TG forum sometime, and there is a nice way to disable this. Searching there might help... Sanjay --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-26 Thread svilen
http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_ data/17/4047/index.html I have to say I've seen better writeups on this topic - so be warned :) that looks very much like '1st 5 things i found about recursive data'. Choosing a strategy for storing hierarchical data in a

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-26 Thread voltron
Thanks Arnar! I´ll prefer to take this off the list since it is only slightly related to SQLAlchemy. On Jun 26, 2:28 am, Arnar Birgisson [EMAIL PROTECTED] wrote: On 6/25/07, voltron [EMAIL PROTECTED] wrote: Thank you very much for your feedback guys! I was very worried the whole day. I

[sqlalchemy] Re: Concurrency control using version_id_col

2007-06-26 Thread Sanjay
Hi Mike, Thanks a lot. It works fine (with or without default=0). The problem was in my TG application, which was not preserving version while populating the edit form. I made version as a hidden field in the form, and it works fine now. Sanjay

[sqlalchemy] Re: advanced mapping help

2007-06-26 Thread svilen
The mapper expects a class, but I can't define Content before ContentCollection and ContentCollection before Content... whhy? SA-wise u have no problem: class X: pass class Y: pass mapper(X, ... y=relation(Y,...) ... ) mapper(Y, ... x=relation(X,...) ... ) The problem might be only in your

[sqlalchemy] Relation ends up as a one-to-one, not a one-to-many

2007-06-26 Thread Paul Johnston
Hi, I have the following property on an object, which is working fine: class VulnResDesc: ... @property def rawvulns(self): return VulnRes.select( and_(VulnRes.c.targetid == self.targetid, VulnMap.c.tool == VulnRes.c.tool,

[sqlalchemy] Re: Relation ends up as a one-to-one, not a one-to-many

2007-06-26 Thread svilen
it might be stupid, but did u try use_list=True ? --~--~-~--~~~---~--~~ 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,

[sqlalchemy] Re: Relation ends up as a one-to-one, not a one-to-many

2007-06-26 Thread Paul Johnston
Ah, that does it. Sorry, that really was stupid! If only I had scrolled down the docs a little bit :-) Thanks svilen. Paul On 6/26/07, svilen [EMAIL PROTECTED] wrote: it might be stupid, but did u try use_list=True ? --~--~-~--~~~---~--~~ You received

[sqlalchemy] alchemy mysql database problem

2007-06-26 Thread warren . emmett
Hi, I am currently using SQLAlchemy in the creation of a mysql database. I use alchemy to create the tables and to access them but I use a python script to collect the information from the necessary sources prepare them and shove them into tab delimited 'out' files which i then load into the

[sqlalchemy] Table updates using data mapping

2007-06-26 Thread voltron
Could someone tell me how I would execute this SQL using data mapping? # SQL UPDATE users SET group=consultant WHERE group = contractor; # Mapped object user_mapper = mapper(User, users) user = User() Thanks --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread Rick Morrison
Updates and inserts on the ORM side of the street are single-object kinds of things. The pattern is to load a list of objects, make the appropriate modifications to the those in-memory objects, and then issue a session flush(). This type of bulk operation is best done with the SQL generation

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread voltron
would I have to do something like this? sess = create_session() allusers = sess.query(User).select() for user in allusers: user.group = contractor print x.name On Jun 26, 10:40 pm, voltron [EMAIL PROTECTED] wrote: Could someone tell me how I would execute this SQL using data

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread Michael Bayer
On Jun 26, 2007, at 4:51 PM, Rick Morrison wrote: Updates and inserts on the ORM side of the street are single-object kinds of things. The pattern is to load a list of objects, make the appropriate modifications to the those in-memory objects, and then issue a session flush(). This

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread Mike Orr
On 6/26/07, voltron [EMAIL PROTECTED] wrote: sess = create_session() allusers = sess.query(User).select() for user in allusers: user.group = contractor print x.name This adds the overhead of creating a Python object for every row. If you already have many of the objects in memory