[sqlalchemy] Re: [Twisted-Python] SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Chris Withers
Matthew Williams wrote: From previous posts to this and other lists, it seems that ORMs and threads don't get along too well... What makes you think that? and, as far as I can tell, there's no way to get away from threads if you don't want longish queries to block your entire

[sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Matthew Williams
On Mar 26, 2010, at 3:20 AM, Chris Withers wrote: Matthew Williams wrote: From previous posts to this and other lists, it seems that ORMs and threads don't get along too well... What makes you think that? First of all, most of my impressions about ORMs come from SQLAlchemy. This

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Chris Withers
Matthew Williams wrote: It's much trickier if you want to use the ORM, unless you are very careful to fully eager load every thing in any possible database operation if you have need of the information subsequently in your twisted code. Otherwise you may block unexpectedly simply when accessing

RE: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Matthew Williams Sent: 26 March 2010 12:10 To: sqlalchemy@googlegroups.com; twisted-pyt...@twistedmatrix.com Subject: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync On Mar

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Matthew Williams
On Mar 26, 2010, at 7:16 AM, Chris Withers wrote: Cool. What is it you're doing that needs to mix Twisted and SQLAlchemy? The project (an internal project) doesn't really *need* to mix them... I could just use mysqldb. Heh, wrong end of the stick again; my question was why you needed to

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Fernando Takai
Hi!, I'm using SQLAlchemy on a heavily threaded env - something like 30~40 threads working with SQLAlchemy objects. What you need to watchout is: * Eager load objects - getting nasty lazyload exceptions is not funny * Take off the objects from the session and, if you need to use them later,

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Chris Withers
King Simon-NFHD78 wrote: The solution to this is either to eager-load all the attributes you think you are going to need before handing the instance off to another thread (difficult), or (probably better) to detach (expunge) the instance from thread A's session. Are there any recommended code

Re: [sqlalchemy] The correct usage of use_alt to avoid circular dependency

2010-03-26 Thread Michael Bayer
Tan Yi wrote: I want to create a table, say: employee_table = Table( 'employee',metadata, Column('id',Integer,primary_key=True), Column('name',String(255)) ) staffGroup_Table = Table( 'role',metadata,

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Michael Bayer
Fernando Takai wrote: Hi!, I'm using SQLAlchemy on a heavily threaded env - something like 30~40 threads working with SQLAlchemy objects. What you need to watchout is: * Eager load objects - getting nasty lazyload exceptions is not funny * Take off the objects from the session and, if you

[sqlalchemy] Re: The correct usage of use_alt to avoid circular dependency

2010-03-26 Thread Tan Yi
Thanks for clarification. Sorry that I do not think I understand circular dependency and compsite key very well. Also can you help me to read the circular dependency error message? I mean How to find the circle from the error message of Circular Dependency. Here is the error message:

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] Re: The correct usage of use_alt to avoid circular dependency

2010-03-26 Thread Michael Bayer
Tan Yi wrote: Thanks for clarification. Sorry that I do not think I understand circular dependency and compsite key very well. Also can you help me to read the circular dependency error message? I mean How to find the circle from the error message of Circular Dependency. Here is the error

[sqlalchemy] UniqueConstraint case sensitive

2010-03-26 Thread jose soares
Hi all, I would like to create an UniqueConstraint like this one: CREATE UNIQUE INDEX uniqinx ON prod(lower(name)) Could you help me to translate it to SQLAlchemy using UniqueConstraint ? Thank you. j -- You received this message because you are subscribed to the Google Groups

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 =

[sqlalchemy] Sequences support for CYCLE and MIN/MAX values

2010-03-26 Thread Kent
Any plans to support MINVALUE, MAXVALUE, CYCLE, NOCYCLE for sequences (for both postgres and oracle)? I've implemented a subclass of Sequence myself, but it isn't very elegant, because I'm not familiar enough with the code to know which methods to override for create() output. -- You received

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

[sqlalchemy] Unifying large objects on commit/flush

2010-03-26 Thread Torsten Landschoff
Hi there! We are considering to use SQLAlchemy for a new project. Our first tests look promising and it is a fun to use SA. But I still have a problem to implement some special features we would like to have. For example, I want to store large (tens to hundreds of MB) objects into the database

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] Sequences support for CYCLE and MIN/MAX values

2010-03-26 Thread Michael Bayer
Kent wrote: Any plans to support MINVALUE, MAXVALUE, CYCLE, NOCYCLE for sequences (for both postgres and oracle)? I've implemented a subclass of Sequence myself, but it isn't very elegant, because I'm not familiar enough with the code to know which methods to override for create() output.

Re: [sqlalchemy] Sequences support for CYCLE and MIN/MAX values

2010-03-26 Thread Michael Bayer
Kent wrote: Any plans to support MINVALUE, MAXVALUE, CYCLE, NOCYCLE for sequences (for both postgres and oracle)? I've implemented a subclass of Sequence myself, but it isn't very elegant, because I'm not familiar enough with the code to know which methods to override for create() output.

Re: [sqlalchemy] Unifying large objects on commit/flush

2010-03-26 Thread Michael Bayer
Torsten Landschoff wrote: While the extension gets called and tries to replace the relation, SA still tries to insert the new entry. Any way to get this implemented? here's the relevant bit of documentation:

[sqlalchemy] Re: want to suppress automatic refresh

2010-03-26 Thread keith cascio
Michael, On Mar 25, 3:00 pm, Michael Bayer mike...@zzzcomputing.com wrote: SQLAlchemy also doesn't issue BEGIN. You might want to look at setting autocommit to false on your MySQLdb connection, since that's the layer that would be sending out BEGIN. I looked into this. BTW, I use

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] Using reflection to create read-only classes and objects

2010-03-26 Thread mr
Hejhej, first I'd like to thank the developers of SQLAlchemy for their great effort. The library works like a treat and is well documented. It's a pleasure working with it... Nevertheless I've currently run into a problem when trying to create classes that are based on read-only reflection from

Re: [sqlalchemy] Using reflection to create read-only classes and objects

2010-03-26 Thread Michael Bayer
mr wrote: Hejhej, first I'd like to thank the developers of SQLAlchemy for their great effort. The library works like a treat and is well documented. It's a pleasure working with it... Nevertheless I've currently run into a problem when trying to create classes that are based on read-only

Re: [sqlalchemy] Re: want to suppress automatic refresh

2010-03-26 Thread Michael Bayer
keith cascio wrote: Every COMMIT is followed by a ROLLBACK, which appears wasteful. Which software do I blame for that, SQLAlchemy or the MySQLdb DBAPI connector? It's not wasteful at all in the usual case unless one wants to have leftover row/table locks and transactional state sitting idle

Re: [sqlalchemy] Sequences support for CYCLE and MIN/MAX values

2010-03-26 Thread Kent Bower
Thanks for the info. Since it is NOCYCLE in oracle and NO CYCLE in postgres, I would check the engine.dialect.name in the compile, method correct? if eng.dialect.name == 'oracle': sql += NOCYCLE elif eng.dialect.name ==

[sqlalchemy] Re: Sequences support for CYCLE and MIN/MAX values

2010-03-26 Thread Kent
Sorry! Nevermind, your link answers that question. Thanks. On Mar 26, 4:23 pm, Kent Bower k...@retailarchitects.com wrote: Thanks for the info. Since it is NOCYCLE in oracle and NO CYCLE in postgres, I would check the engine.dialect.name in the compile, method correct?                    

Re: [sqlalchemy] Unifying large objects on commit/flush

2010-03-26 Thread Torsten Landschoff
Hi Michael, On Fri, 2010-03-26 at 14:30 -0400, Michael Bayer wrote: here's the relevant bit of documentation: http://www.sqlalchemy.org/docs/reference/orm/interfaces.html?highlight=mapperextension#sqlalchemy.orm.interfaces.MapperExtension.before_insert Column-based attributes can be

[sqlalchemy] Re: want to suppress automatic refresh

2010-03-26 Thread keith cascio
Michael, I apologize if I came off at all rude. I noticed how helpful you are and I value your advice. Thank you for your patience. On Mar 26, 1:21 pm, Michael Bayer mike...@zzzcomputing.com wrote: It's not wasteful at all in the usual case unless one wants to have leftover row/table locks

Re: [sqlalchemy] Re: want to suppress automatic refresh

2010-03-26 Thread Michael Bayer
On Mar 26, 2010, at 7:36 PM, keith cascio wrote: Here is a ping from the real production client against the real production server: $ /usr/sbin/ping -s a.bbb..d.com . . a.bbb..d.com PING Statistics 17 packets transmitted, 17 packets received, 0% packet