[sqlalchemy] Re: DB Redundancy

2009-05-08 Thread Ants Aasma
On May 7, 4:15 pm, goo...@venix.com goo...@venix.com wrote: MySQL has a mechanism for a database to read the log from a master database and replay the commands.  This provides a loose coupling with near real-time backup of the data.  Should the backup server stop or lose contact, the primary

[sqlalchemy] session.begin_nested() (=Savepoints) on SQLite

2009-05-08 Thread Hermann Himmelbauer
Hi, I'm currently trying to use savepoints on SQLite, however, there are some problems with it which I don't understand. The following traceback occurs quite often: - snip -- File /home/dusty/prog/bsp/buildout/src/bsp/bsp/tests/__init__.py, line 156,

[sqlalchemy] Re: ForeignKey schema and Table schema

2009-05-08 Thread Aculeus
Sorry, I missed an example in my first message. The problem arises when you try to query across two databases: Session.query(MainUser).join((OtherUser, OtherUser.id == MainUser.id)) Would normally products something like: SELECT * FROM MainUser INNER JOIN OtherUser ON OtherUser.id =

[sqlalchemy] How to run a stored procedure?

2009-05-08 Thread Daniel
Hello, I've created a stored procedure in MSSQL. I'm not sure how to use it in SQLAlchemy. The stored procedure is called 'claim_highest_priority_work' and I can call it directly as follows: result = conn.execute('claim_highest_priority_work') I know it runs because I see the result in the

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Michael Bayer
Daniel wrote: Hello, I've created a stored procedure in MSSQL. I'm not sure how to use it in SQLAlchemy. The stored procedure is called 'claim_highest_priority_work' and I can call it directly as follows: result = conn.execute('claim_highest_priority_work') I know it runs because I

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
Thanks Michael, When I try that it produces this SQL SELECT claim_highest_priority_work() AS claim_highest_priority_work_1 and this error 'claim_highest_priority_work' is not a recognized built-in function name. On May 8, 10:20 am, Michael Bayer mike...@zzzcomputing.com wrote: Daniel wrote:

[sqlalchemy] Re: ForeignKey schema and Table schema

2009-05-08 Thread Michael Bayer
Aculeus wrote: Sorry, I missed an example in my first message. The problem arises when you try to query across two databases: Session.query(MainUser).join((OtherUser, OtherUser.id == MainUser.id)) Would normally products something like: SELECT * FROM MainUser INNER JOIN OtherUser ON

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Michael Bayer
Daniel wrote: Thanks Michael, When I try that it produces this SQL SELECT claim_highest_priority_work() AS claim_highest_priority_work_1 and this error 'claim_highest_priority_work' is not a recognized built-in function name. this is more of an MSSQL how to issue then. on most

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
On mssql, when I run the query, either calling it by name or calling EXEC and then the procedure name, it returns the result. The problem is that if I try to call result.fetchall(), it give this error: ProgrammingError: (ProgrammingError) Attempt to use a closed cursor. None None I know that

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Michael Bayer
Daniel wrote: On mssql, when I run the query, either calling it by name or calling EXEC and then the procedure name, it returns the result. The problem is that if I try to call result.fetchall(), it give this error: ProgrammingError: (ProgrammingError) Attempt to use a closed cursor. None

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
Michael, I'm not sure if this helps, but I've noticed that if my stored procedure returns all null values, then I can fetch them. If they are non-null values I get an error: [Dbg] result = conn.execute('claim_highest_priority_work') [Dbg] print result.fetchone() Traceback (most recent call

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
I've just been looking through the code in mssql.py and the change mentioned in the changeset I mentioned isn't there anymore. I also can't see that's it's been abstracted to a parent class. Is there a possibility that this bug has crept back in? If so, let me know where the sensible place

[sqlalchemy] Building an or_ filter in loop

2009-05-08 Thread Bryan
I can't figure out a clean way of adding a bunch of filter terms to a query in a loop joined by an OR clause. Successive calls to filter join the expressions by AND. I would like to do something like the following, but have the expressions joined by OR terms = ['apple', 'orange', 'peach'] q =

[sqlalchemy] Re: Building an or_ filter in loop

2009-05-08 Thread Kyle Schaffrick
On Fri, 8 May 2009 12:52:09 -0700 (PDT) Bryan bryanv...@gmail.com wrote: I can't figure out a clean way of adding a bunch of filter terms to a query in a loop joined by an OR clause. Successive calls to filter join the expressions by AND. I would like to do something like the following,

[sqlalchemy] Re: Building an or_ filter in loop

2009-05-08 Thread Bryan
That worked, thanks On May 8, 12:59 pm, Kyle Schaffrick k...@raidi.us wrote: On Fri, 8 May 2009 12:52:09 -0700 (PDT) Bryan bryanv...@gmail.com wrote: I can't figure out a clean way of adding a bunch of filter terms to a query in a loop joined by an OR clause.  Successive calls to

[sqlalchemy] Re: 0.5.3 ORM, MSSQL and FreeTDS: Invalid Cursor State exception?

2009-05-08 Thread mtrier
If you change the test case to indicate that supports_unicode and supports_unicode_statements = False, then it runs just fine with the fix.  Without the fix it fails as well, which indicates to me the issue is in FreeTDS. I'd like to commit this but I want to have a discussion with Mike