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 = Column(Binary(4),  nullable=False)
>
>  def __init__(self, keyval, binval):
>    self.keycol = keyval
>    self.bincol = binval
>
> s (this is my session)
>
> new = FooTable('row1')
> s.add(new)
> s.commit()
>
> At this point I get a server error like so:
> """
> Disallowed implicit conversion from data type varchar to data type
> binary, table 'TWO.dbo.SY00500', column 'BCHEMSG1'. Use the CONVERT
> function to run this query.
> """
> I have tried everything I can think of ["",0,0x0,'0x0',hex(0)] as
> binval for this col and always come back to the same error.
>
> For my setup, I am on SA .5 with pymssql on MacOSX 10.5.  I did see
> the notice about some non-specific binary issues with pymssql, but
> nothing indicated it flat out didn't work.
>
> I am hoping someone can tell me what I'm missing here.
>

I dont use MS-SQL, but I'm going to go out on a limb here based on  
what I've read and say that you should really be using pyodbc.   
pymssql is apparently very old and unmaintained and appears to have  
poor support for non-ASCII streams.

to the list:   perhaps mssql.py should emit a warning when pymssql is  
being used ?








--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to