[sqlalchemy] flush and transactions, doesn't roll back

2007-06-25 Thread mc
I have the following piece of code: transaction = session.create_transaction() try: # Do some work here that might fail p=P() p.ID=333 session.save(p) session.flush() # Do some more work here that might fail p1=P() p1.ID=333 session.save(p1) session.flush() # Success, commit everything

[sqlalchemy] Re: Bug in selection from many-to-many relationship?

2007-06-25 Thread Michael Bayer
On Jun 24, 2007, at 10:52 PM, Hong Yuan wrote: mapper(Address, address) person_address_mapper = mapper(PersonAddress, person_address, properties={'address': relation(Address, lazy=False)} ) personmapper = mapper(Person, person, properties={ 'addresses':

[sqlalchemy] Re: flush and transactions, doesn't roll back

2007-06-25 Thread Michael Bayer
On Jun 25, 2007, at 4:09 AM, mc wrote: I have the following piece of code: transaction = session.create_transaction() try: # Do some work here that might fail p=P() p.ID=333 session.save(p) session.flush() # Do some more work here that might fail p1=P() p1.ID=333 session.save(p1)

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-25 Thread Michael Bayer
id make tables to store the expression components and their relationships distinctly. then again, im looking for cool things to write blog posts about. short answer: put it in a text-based field, JSON is essentially text. --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Storing JSON objects, maybe OT

2007-06-25 Thread voltron
I apologize if this is the wrong place to ask this question. I would like to store and retrieve JSON objects from a database, the JSON object holds a list of menu items for my site. What would be the best way to achieve this? 1. Convert the JSON object to Python code using simplejson, pickle

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-25 Thread voltron
Thank you very much for your feedback guys! I was very worried the whole day. I did some research and found this: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/index.html This shows different methods of storing hierarchical data, but I just did not like the mind

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-25 Thread Arnar Birgisson
On 6/25/07, voltron [EMAIL PROTECTED] wrote: Thank you very much for your feedback guys! I was very worried the whole day. I did some research and found this: 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