[sqlalchemy] Re: Caching

2007-12-22 Thread Anton V. Belyaev
merge is working rudimentally for objects with unloaded scalar/ instance/collection attributes in r3974. whats not yet happening is the merging of the various query.options() that may be present on the original deferred loader, which means the merged instance wont necessarily maintain the

[sqlalchemy] Re: Caching

2007-12-21 Thread Anton V. Belyaev
I rearranged instance-level deferred loaders to be serializable instances in r3968. you can now pickle an instance + its _state and restore, and all deferred/lazy loaders will be restored as well. I didnt yet test it specifically with merge() but give it a try, you shoudnt be getting that

[sqlalchemy] Re: Caching

2007-12-20 Thread Anton V. Belyaev
Mike, thanks for your reply. what happens if you just leave _state alone ? there shouldnt be any need to mess with _state (nor _entity_name). the only attribute worth deleting for the cache operation is _sa_session_id so that the instance isnt associated with any particular session when

[sqlalchemy] Re: Caching

2007-12-20 Thread Anton V. Belyaev
pickle isnt going to work with deferred columns unless you implement __getstate__ and __setstate__. so the issue with session.merge() is just an extension of that issue, correct ? i.e. without deferreds merge has no issue. is it not reasonable to ask that objects which are to be

[sqlalchemy] Caching

2007-12-19 Thread Anton V. Belyaev
Hello, Several people already wrote something about memcached + SqlAlchemy. Remember, Mike Nelson wrote a mapper extention, it is available at: http://www.ajaxlive.com/repo/mcmapper.py http://www.ajaxlive.com/repo/mcache.py I've rewritten it a bit to fit 0.4 release of SA. Any response and

[sqlalchemy] Re: SA and MySQL replication.

2007-12-09 Thread Anton V. Belyaev
On Dec 6, 11:51 pm, Andrew Stromnov [EMAIL PROTECTED] wrote: I have DB with onemasterserver and several replicated slaves (MySQL). How to implement this functionality: read-only request can be passed to any DB (masterorslave), but any write request with following read requests must be sended

[sqlalchemy] Re: Unnecessary selects when cascade=all, delete-orphane and composite keys

2007-11-19 Thread Anton V. Belyaev
I am building a grading system for students and got unexpected performance problems. I am using composite key for marks, which refer to students and subjects. When I am creating a mark (for student_1 and subject_1), unnecessary select operations are performed (select all marks for

[sqlalchemy] Unnecessary selects when cascade=all, delete-orphane and composite keys

2007-11-18 Thread Anton V. Belyaev
Hello all, I am building a grading system for students and got unexpected performance problems. I am using composite key for marks, which refer to students and subjects. When I am creating a mark (for student_1 and subject_1), unnecessary select operations are performed (select all marks for

[sqlalchemy] SA does implicit cascading

2007-09-03 Thread Anton V. Belyaev
Hello, here is a sample: children_table = Table('children', metadata, Column('id', Integer, primary_key=True)) child2group_table = Table('child2group', metadata, Column('child_id', Integer, ForeignKey('children.id'),

[sqlalchemy] Re: Consistency with DB while modifying metadata

2007-07-25 Thread Anton V. Belyaev
t = Table('mytable', meta, Column(...) ) someothermeta = MetaData() t2 = Table('mytable', someothermetadata, autoload=True, autoload_with=connection) assert t.compare(t2) I believe this should be done somehow automatically. Because everyone needs this.

[sqlalchemy] Consistency with DB while modifying metadata

2007-07-24 Thread Anton V. Belyaev
Hey, I believe there is a common approach to the situation, but I just dont know it. Let say, I have some tables created in the DB using SQLAlchemy. Then I modify Python code, which describes the table (add a column, remove another column,...). What is the common way to handle this situation? I

[sqlalchemy] Re: Consistency with DB while modifying metadata

2007-07-24 Thread Anton V. Belyaev
On 24 июл, 17:34, svilen [EMAIL PROTECTED] wrote: On Tuesday 24 July 2007 16:22:43 Anton V. Belyaev wrote: Hey, I believe there is a common approach to the situation, but I just dont know it. Let say, I have some tables created in the DB using SQLAlchemy. Then I modify Python code