[sqlalchemy] Trouble inserting Binary into MSSQL DB's

2008-09-19 Thread widmer . sam
I am having a problem inserting binary data into an existing MS DB. A very simple example is like this class FooTable: __tablename__ = 'mytable' keycol = Column(String(15), nullable=False, primary_key=True) bincol = Column(Binary(4), nullable=False) def __init__(self, keyval, binval):

[sqlalchemy] Re: Problem with coverage and sqlalchemy declarative synonym?

2008-09-19 Thread Michael Bayer
On Sep 18, 2008, at 4:08 PM, Doug Latornell wrote: With some help from Ned Batchelder I was able to confirm that this is a Python bug: http://bugs.python.org/issue1569356 that has been fixed since the 2.5.2 release. Ned confirmed that the fix is included in Python 2.6a3. well

[sqlalchemy] Re: Trouble inserting Binary into MSSQL DB's

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 3:25 AM, [EMAIL PROTECTED] wrote: I am having a problem inserting binary data into an existing MS DB. A very simple example is like this class FooTable: __tablename__ = 'mytable' keycol = Column(String(15), nullable=False, primary_key=True) bincol =

[sqlalchemy] How to determine the right number of pooled connections to use

2008-09-19 Thread Alen Ribic
Good day. I tried to perform a load test on my python web app using sqlalchemy as follows: 1000 requests 20 concurrent connections Towards the end, I started getting an error from sqlalchemy module: TimeoutError: QueuePool limit of size 40 overflow 10 reached, connection timed out, timeout 30

[sqlalchemy] Re: How to determine the right number of pooled connections to use

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 10:05 AM, Alen Ribic wrote: Good day. I tried to perform a load test on my python web app using sqlalchemy as follows: 1000 requests 20 concurrent connections Towards the end, I started getting an error from sqlalchemy module: TimeoutError: QueuePool limit of size

[sqlalchemy] Re: How to determine the right number of pooled connections to use

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 11:16 AM, Alen Ribic wrote: Michael, thank you for you reply. Question: if my web request fails to return a response, hence request method doesn't exit gracefully, could that perhaps cause a connection not to be returned to a connection pool? Reason I ask this is that

[sqlalchemy] Re: Trouble inserting Binary into MSSQL DB's

2008-09-19 Thread Rick Morrison
There's no doubt that pyodbc is the better-supported option; the pymssql module hasn't been updated in two years, and it relies on the Microsoft DB lib, which has been deprecated for a long, long time and is no longer supported, and may not even work with MSSQL 2008. Here's the deprecation notice

[sqlalchemy] Re: How to determine the right number of pooled connections to use

2008-09-19 Thread Alen Ribic
On Sep 19, 5:21 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 19, 2008, at 11:16 AM, Alen Ribic wrote: if the thread in which the request was served continues to run, not   serve further requests, and does not clean up after itself, then the   connections held open local to that thread

[sqlalchemy] Re: grandparent id relation

2008-09-19 Thread GHZ
On Sep 18, 2:54 pm, Michael Bayer [EMAIL PROTECTED] wrote: 2. more involved: catch change events and populate a Child.grandparent   relation().   0.5 has made the AttributeExtension API public which   would be a good place to catch this event.  The advantage to this is   that your Child has a

[sqlalchemy] Re: grandparent id relation

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 11:47 AM, GHZ wrote: On Sep 18, 2:54 pm, Michael Bayer [EMAIL PROTECTED] wrote: 2. more involved: catch change events and populate a Child.grandparent relation(). 0.5 has made the AttributeExtension API public which would be a good place to catch this event. The

[sqlalchemy] Using database functions in UPDATE statement

2008-09-19 Thread Hans Lellelid
Hi, I'm using SA 0.4.6 and I'm having trouble using the result of a database function / stored procedure in an UPDATE statement (being constructed with SQL expression lang). This happens to be for using PostGIS columns; however, that is not relevant to the problem here. I have tried doing

[sqlalchemy] Re: Using database functions in UPDATE statement

2008-09-19 Thread Hans Lellelid
In response to myself ... I discovered that it was only when I was specifying the function clauses as bind params in the conn.execute() method that it was failing. The code I presented should actually be working correctly. To be explicit, this seems to be working:

[sqlalchemy] Re: Trouble inserting Binary into MSSQL DB's

2008-09-19 Thread Sam Widmer
Thanks for the responses so far. The reason we tried pymssql is because it is much easier to get running on OSX. At the moment our efforts to get pyodbc working on Macs have met with alot of frustration. However, we would have done things differently if we had seen different wording in the

[sqlalchemy] Re: Using database functions in UPDATE statement

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 12:52 PM, Hans Lellelid wrote: Hi, I'm using SA 0.4.6 and I'm having trouble using the result of a database function / stored procedure in an UPDATE statement (being constructed with SQL expression lang). This happens to be for using PostGIS columns; however, that

[sqlalchemy] Re: Using database functions in UPDATE statement

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 1:18 PM, Hans Lellelid wrote: In response to myself ... I discovered that it was only when I was specifying the function clauses as bind params in the conn.execute() method that it was failing. The code I presented should actually be working correctly. To be

[sqlalchemy] Re: Trouble inserting Binary into MSSQL DB's

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 1:24 PM, Sam Widmer wrote: Thanks for the responses so far. The reason we tried pymssql is because it is much easier to get running on OSX. At the moment our efforts to get pyodbc working on Macs have met with alot of frustration. However, we would have done

[sqlalchemy] Re: Using database functions in UPDATE statement

2008-09-19 Thread Hans Lellelid
ah.   right, the parameter argument of execute() does not handle SQL   expressions as values - the keys are used to generate a corresponding   list of bind parameter clauses.   Earlier versions of SQLA were more   liberal in this regard but the current behavior was based around   simplifying

[sqlalchemy] Re: Using database functions in UPDATE statement

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 1:54 PM, Hans Lellelid wrote: ah. right, the parameter argument of execute() does not handle SQL expressions as values - the keys are used to generate a corresponding list of bind parameter clauses. Earlier versions of SQLA were more liberal in this regard but the

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-19 Thread Rick Morrison
Hi John, Is the column you're having issues with really a VARCHAR, or is the message misleading? How did you create the table, pre-existing or via SQLAlchemy? Can you show the schema and the code you're trying to access it with? Thanks, Rick On Fri, Sep 19, 2008 at 2:54 PM, John Hampton

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-19 Thread John Hampton
Rick Morrison wrote: Is the column you're having issues with really a VARCHAR, or is the message misleading? How did you create the table, pre-existing or via SQLAlchemy? Can you show the schema and the code you're trying to access it with? It's a preexisting table. The column in the DB

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-19 Thread Rick Morrison
Hmmm, looks to me as if SQLA is generating the query correctly, but that the DBAPI passes along the Binary() value encoded in a Python binary string, which MSSQL then interprets as Varchar, and then complains that it can't do an implicit conversion. That's a surprise to me; I had thought that this

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-19 Thread John Hampton
John Hampton wrote: This is the same conclusion that I had while talking with Mike on IRC. Mike believes that there are others out there that use MSSQL and SQLAlchemy that have BINARY columns working fine. I was hoping that this is true and someone who has had success could share an

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-19 Thread Michael Bayer
On Sep 19, 2008, at 4:14 PM, Rick Morrison wrote: Mike, any perspective on how difficult it might be to get the MSSQL Dialect to emit the CONVERT syntax for binary fields, or would converting the value itself using base64 encoding be the better path? we've had the notion of

[sqlalchemy] Forks() and Alchemy

2008-09-19 Thread cono
Hi, I'm having problems with a process that uses an sqlAlchemy session, and after that it forks. From that moment I have 2 processes (can be more) that uses alchemy sessions. Both processes fails with ProgrammingError: (ProgrammingError) SET TRANSACTION ISOLATION LEVEL must be called before any