Re: [sqlalchemy] pymssql and uuid.UUID convertion

2012-11-23 Thread Michael Bayer
On Nov 21, 2012, at 4:42 PM, Ivan Kalinin wrote: Hellow, fellow developers! I have run into and issue trying to use SQLAlchemy (0.7.4) and recent pymssql (2.0.0). Precisely, pymssql can not handle uuid.UUID objects as parameters (see related post on their ML here), but SA uses them

Re: [sqlalchemy] pymssql and uuid.UUID convertion

2012-11-23 Thread Ivan Kalinin
Thanks for the reply! However, I see that MSSQL dialect contains a UNIQUEIDENTIFIER type that is to represent similarly named column type. Looks like it should handle issues of marshalling the values, not some custom type. On Friday, November 23, 2012 7:39:50 PM UTC+4, Michael Bayer wrote:

Re: [sqlalchemy] pymssql and uuid.UUID convertion

2012-11-23 Thread Michael Bayer
In my own MSSQL work, we use character fields for UUIDs as the DBAs were not in favor of trying to get UNIQUEIDENTIFIER to work. However, feel free to use UserDefinedType to implement UNIQUEIDENTIFIER including whatever coercion pymssql requires

Re: [sqlalchemy] pymssql and uuid.UUID convertion

2012-11-23 Thread Ivan Kalinin
Wait. I mean that SA _already_ has implemented UNIQUEIDENTIFIER over here: https://bitbucket.org/sqlalchemy/sqlalchemy/src/0c8e0b613da3b2bf6e965e1e5c15b6b3e540368a/lib/sqlalchemy/dialects/mssql/base.py?at=default#cl-478 I believe that thing should be responsible for valid marshalling/unmarshalling

Re: [sqlalchemy] pymssql and uuid.UUID convertion

2012-11-23 Thread Michael Bayer
ideally pymssql would know how (and are you saying that pyodbc does already?), but sure, SQLA does all kinds of coercion. For now, your options are to use the TypeDecorator recipe mentioned earlier around this UNIQUEIDENTIFIER type, or send me a pull request with a pymssql-specific type

Re: [sqlalchemy] pymssql and uuid.UUID convertion

2012-11-23 Thread Ivan Kalinin
Wow, thanks! But that looks pretty complex. I believe a more valid way of fixing the issue is a patch for pymssql itself - since it's relatively simple and already available: https://bitbucket.org/PuPSSMaN/pymssql/changeset/ed48708effdb481a9695e58876e223eb I'll try to contact pymssql mantainer to

[sqlalchemy] pymssql and uuid.UUID convertion

2012-11-21 Thread Ivan Kalinin
Hellow, fellow developers! I have run into and issue trying to use SQLAlchemy (0.7.4) and recent pymssql (2.0.0). Precisely, pymssql can not handle uuid.UUID objects as parameters (see related post on their ML herehttps://groups.google.com/forum/?fromgroups=#!topic/pymssql/ah6f8cl2Va0), but