[sqlalchemy] Re: Do we have support for PostgreSQL's JSON data type?

2013-09-03 Thread John Yeuk Hon Wong
Okay. I looked at custom type and was about to implement one and I found this: http://docs.sqlalchemy.org/en/rel_0_8/core/types.html?highlight=json#marshal-json-strings Do we have a plan to add JSON type? I am looking at range.py and hstore.py to get an idea how one writes a data type. John

Re: [sqlalchemy] error related to setting attribute to same value twice

2013-09-03 Thread lars van gemerden
I am getting that same error (not the original one). For the moment i've solved the problem in a different way, but it might pop up again. I'll keep merge in mind (i've run into the is already attached to session before). Thank you, Lars On Monday, September 2, 2013 9:18:11 PM UTC+2, Simon

Re: [sqlalchemy] error related to setting attribute to same value twice

2013-09-03 Thread Simon King
I realised after I sent that script that I wasn't reproducing quite the same situation. I should have loaded the person from the database in sess2 as well, before trying to add the instance from sess1. In other words, change the end of the test script to say: sess2 = Session() dupe =

Re: [sqlalchemy] Occasional IntegrityError when identifying model not by its ID

2013-09-03 Thread Simon King
Race conditions can happen at any time, not just when the system is under heavy load. You only need 2 requests to arrive at approximately the same time to trigger a race condition. On Tue, Sep 3, 2013 at 12:49 PM, herzaso herz...@gmail.com wrote: Another important thing - I don't think it's a

Re: [sqlalchemy] Occasional IntegrityError when identifying model not by its ID

2013-09-03 Thread Simon King
OK, I agree that doesn't sound like a race as such. It sounds more like some connection state is being shared between requests. I haven't used Tornado before and don't know much about it. Its main feature is that it uses asynchronous IO, unlike most other python web servers that use threads for

Re: [sqlalchemy] Occasional IntegrityError when identifying model not by its ID

2013-09-03 Thread Ladislav Lenart
On 3.9.2013 14:28, Simon King wrote: OK, I agree that doesn't sound like a race as such. It sounds more like some connection state is being shared between requests. That might be it. We had a very similar bug: We stored ORM objects in the module level and did not imediately realize that these

Re: [sqlalchemy] attribute_mapped_collection use as a key-list dictionary

2013-09-03 Thread Paul Balomiri
Hi, Trying to advance on this issue i wrote an InstrumentedList which shall: * hold only values sharing the same key as defined by a property on the values * change that property to the list value upon insertion * set the property to whatever null value is defined when the value is removed from

Re: [sqlalchemy] Occasional IntegrityError when identifying model not by its ID

2013-09-03 Thread Simon King
I don't honestly know, but if this were my project I would be trying very hard to ensure that both (session.commit or session.rollback) followed by session.close were being called at the end of every single request. Are you using any of Tornado's asynchronous capabilities (eg.

Re: [sqlalchemy] error related to setting attribute to same value twice

2013-09-03 Thread lars van Gemerden
My version is 0.7.5 (thought i was on 8 already), i will look at updating! The error sounds similar, I'll get back on this after i do (after some research to find out if updating is a good idea right now) Cheers, Lars On Tue, Sep 3, 2013 at 11:38 AM, Simon King si...@simonking.org.uk wrote:

[sqlalchemy] Re: an unkown object in code.

2013-09-03 Thread Mohsen Pahlevanzadeh
Thank you for your information. On Sunday, September 1, 2013 10:04:48 PM UTC+4:30, herzaso wrote: the c object is short for columns (you can use either) check out http://docs.sqlalchemy.org/en/rel_0_7/core/schema.html On Sunday, September 1, 2013 8:27:12 PM UTC+3, Mohsen Pahlevanzadeh

Re: [sqlalchemy] an unkown object in code.

2013-09-03 Thread Mohsen Pahlevanzadeh
Thank you for your information. On Monday, September 2, 2013 2:33:21 AM UTC+4:30, Simon King wrote: On 1 Sep 2013, at 18:27, Mohsen Pahlevanzadeh m.pahle...@gmail.comjavascript: wrote: Dear all, Before apply code or writing code from a documentation, At first i test it into

[sqlalchemy] DateTime vs timestamp

2013-09-03 Thread Mohsen Pahlevanzadeh
Dear all, I'm using mysql, and define my field as timestamp data type. Then i defined DateTime in my class table and Table() constructor same field. Is it true? Does it save epoch ? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] Do we have support for PostgreSQL's JSON data type?

2013-09-03 Thread Michael Bayer
there's a trac ticket surrounding the job of adding the JSON type: http://www.sqlalchemy.org/trac/ticket/2581 the closest type resembling this is the HSTORE type, so an approach here would likely want to draw from some of the techniques of HSTORE. On Sep 3, 2013, at 2:31 AM, John Yeuk Hon

Re: [sqlalchemy] Mimik joinedload for core tables/queries

2013-09-03 Thread gbr
Thanks. That's quite an interesting piece of code. There's a bit of magic happening in this code and it's not quite compatible for my use case (use of queries instead of tables, no ORM mapping), so allow me to ask some questions. I've annotated the code, so perhaps you can correct any of my

Re: [sqlalchemy] attribute_mapped_collection use as a key-list dictionary

2013-09-03 Thread Michael Bayer
On Sep 3, 2013, at 8:47 AM, Paul Balomiri paulbalom...@gmail.com wrote: I would like to install event.listen(list, 'append', append_listener) event.listen(list, 'remove', rm_listener) on those lists, such that the GroupByKeyCollection can modify added objects according to the

Re: [sqlalchemy] Mimik joinedload for core tables/queries

2013-09-03 Thread Michael Bayer
On Sep 3, 2013, at 11:03 PM, gbr doubl...@directbox.com wrote: Thanks. That's quite an interesting piece of code. There's a bit of magic happening in this code and it's not quite compatible for my use case (use of queries instead of tables, no ORM mapping), so allow me to ask some