[sqlalchemy] Re: Insertion order not respecting FK relation

2008-06-11 Thread Malthe Borch
I can add to this that the issue occurs only on consequent appends. Here's the excerpt that leads to the IntegrityError, demonstrating this. collection = Collection() session.save(collection) session.flush() vinyl = Vinyl() colletion.records.append(vinyl)

[sqlalchemy] Re: assocClass.linkA == A.id fails

2008-06-11 Thread az
well, it will be useful if when a m/anytoone relation (i.e. plain reference) klas.descriptor is used in an expression context, to yield just the respective column. On Tuesday 10 June 2008 21:15:06 Michael Bayer wrote: these are the valid comparisons: print AB.this == A() print AB.this_id

[sqlalchemy] Re: Performance problem with Psyco

2008-06-11 Thread az
if u replace back the offending function with its plain pythonic variant, will it work? 50% boost... just because of the python? u're constructing too many queries over and over. try cache them, and reuse as building blocks... - or cache their results... or change the model. e.g. on my model

[sqlalchemy] Re: Performance problem with Psyco

2008-06-11 Thread Michael Bayer
On Jun 10, 2008, at 3:13 PM, Artur Siekielski wrote: On Jun 10, 8:11 pm, Michael Bayer [EMAIL PROTECTED] wrote: I would first take a look at the SQL being issued as the first source of speed differences; if in 0.4.5 there's suddenly a whole series of deletes occuring which do not

[sqlalchemy] Re: Insertion order not respecting FK relation

2008-06-11 Thread Michael Bayer
you'd have to work this into a full self-contained script which I can run locally since it seems theres some specific usage pattern creating the issue. (i.e. its very difficult for me to piece together snippets and guess where the issue might be occuring). On Jun 11, 2008, at 5:43 AM,

[sqlalchemy] Second DSN create_engine logic

2008-06-11 Thread fairwinds
Hi, I have been thinking about logic for a second DSN for failover with some time interval to try the second source. If I am using asynchronous replication, time is required to allow slave to become master. For application logic, I don't want to tolerate a failure. Rather, I want to log

[sqlalchemy] Re: Second DSN create_engine logic

2008-06-11 Thread Michael Bayer
On Jun 11, 2008, at 10:01 AM, fairwinds wrote: Hi, I have been thinking about logic for a second DSN for failover with some time interval to try the second source. If I am using asynchronous replication, time is required to allow slave to become master. For application logic, I don't

[sqlalchemy] Re: Cannot abort wxPython thread with SQLAlchemy

2008-06-11 Thread Peter Hansen
Dominique wrote: On 10 juin, 02:38, Peter Hansen [EMAIL PROTECTED] wrote: As Python has no way to actually terminate a thread, can you explain what you mean by stop this thread? Are you simply cloning the code from the wxPython example, with the delayedresult.AbortEvent() object, and

[sqlalchemy] Re: Performance problem with Psyco

2008-06-11 Thread Artur Siekielski
On Jun 11, 11:53 am, [EMAIL PROTECTED] wrote: if u replace back the offending function with its plain pythonic variant, will it work? Which function do you mean? 50% boost... just because of the python? u're constructing too many queries over and over. No, the main module in which we have

[sqlalchemy] Re: Second DSN create_engine logic

2008-06-11 Thread fairwinds
Hi Michael. I appreciate your reply. Did not know if it was something you'd want for consider for stock sqlalchemy. Incorporating into app is easy enough. I like the transparency of your recommendation. Many thanks. Regards, David On Jun 11, 11:15 am, Michael Bayer [EMAIL PROTECTED] wrote: On

[sqlalchemy] text

2008-06-11 Thread jack2318
I tried very simple test: s = text(SELECT COUNT(*) FROM table WHERE field LIKE 'something') count = conn.execute(s).fetchone() and this produced error Unexpected error: type 'exceptions.TypeError' not enough arguments for format string not big deal there is few way around but just for

[sqlalchemy] Re: text

2008-06-11 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jack2318 Sent: 11 June 2008 17:50 To: sqlalchemy Subject: [sqlalchemy] text I tried very simple test: s = text(SELECT COUNT(*) FROM table WHERE field LIKE 'something') count =

[sqlalchemy] Re: text

2008-06-11 Thread Andreas Jung
--On 11. Juni 2008 17:55:44 +0100 King Simon-NFHD78 [EMAIL PROTECTED] wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jack2318 Sent: 11 June 2008 17:50 To: sqlalchemy Subject: [sqlalchemy] text I tried very simple test: s =

[sqlalchemy] sqlalchemy sessions, Queue

2008-06-11 Thread bollwyvl
I've got a thread that creates a new instances (connected to a realtime interface), a main thread, and a pool of threads that *does stuff* to my instances. After *the stuff* is done, they usually get written to the database by the main thread. What's the right way to remove these things from

[sqlalchemy] query arithmetics

2008-06-11 Thread az
hello. back to that theme of query.filter_or() and the missing notion of logical parenthesises http://groups.google.com/group/sqlalchemy/browse_thread/thread/f6798eb5ef2c0bfe i used once the subject in some explaination but just now realized what it can mean. can we define arithmetics over

[sqlalchemy] Re: text

2008-06-11 Thread jack2318
Yep. You are right %% instead of \% thanks -- jacek On Jun 11, 9:59 am, Andreas Jung [EMAIL PROTECTED] wrote: --On 11. Juni 2008 17:55:44 +0100 King Simon-NFHD78 [EMAIL PROTECTED] wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf

[sqlalchemy] awful query

2008-06-11 Thread az
here this trouble... i have a forest of bitemporal/versioned objects that are all linked via m2m relations, and all they own parameters, via m2m again. any idea how to map something like this then without going down to tables: (pseudocode) Doc.ver == ver and ( Doc.dbid ==

[sqlalchemy] Re: reading from one database and writing to another

2008-06-11 Thread qhfgva
Thanks for the replies. I'll have to take a while to digest the comments and suggestions to see how I'm going to proceed. I'm sort of in an initial trial mode working a few hours here and there to get an idea if using sqlalchemy is feasible. I'm expecting it will be and I'll probably just

[sqlalchemy] Is it possible to have a relation on string?

2008-06-11 Thread Bobby Impollonia
Does SA support the following scenario? : I have a class (let's call in User). I have a many-to-many relationship between Users and urls where a url is just a string. So I want to have a secondary table where one column is a foreign key on User and the other is a string. If the second column

[sqlalchemy] Re: query arithmetics

2008-06-11 Thread Michael Bayer
On Jun 11, 2008, at 9:43 AM, [EMAIL PROTECTED] wrote: hello. back to that theme of query.filter_or() and the missing notion of logical parenthesises http://groups.google.com/group/sqlalchemy/browse_thread/thread/f6798eb5ef2c0bfe i used once the subject in some explaination but just now

[sqlalchemy] Re: awful query

2008-06-11 Thread Michael Bayer
On Jun 11, 2008, at 10:45 AM, [EMAIL PROTECTED] wrote: here this trouble... i have a forest of bitemporal/versioned objects that are all linked via m2m relations, and all they own parameters, via m2m again. any idea how to map something like this then without going down to tables:

[sqlalchemy] Re: Is it possible to have a relation on string?

2008-06-11 Thread Michael Bayer
On Jun 11, 2008, at 3:06 PM, Bobby Impollonia wrote: Does SA support the following scenario? : I have a class (let's call in User). I have a many-to-many relationship between Users and urls where a url is just a string. So I want to have a secondary table where one column is a foreign key

[sqlalchemy] Re: Insertion order not respecting FK relation

2008-06-11 Thread Malthe Borch
Michael Bayer wrote: you'd have to work this into a full self-contained script which I can run locally since it seems theres some specific usage pattern creating the issue. (i.e. its very difficult for me to piece together snippets and guess where the issue might be occuring). This is

[sqlalchemy] Re: Insertion order not respecting FK relation

2008-06-11 Thread Michael Bayer
thanks for this example. There's several issues with this mapping. The most crucial, although not the issue in this specific example, is that the relations table is used both as the secondary table in a relation(), and is also mapped directly to the Relation class. SQLA does not track