I am doing some work on a SA engine for Sybase Adaptive Server Enterprise (ASE) on top of both pyodbc and the Sybase DB-API driver. The existing sybase engine for SA only works with Sybase Anywhere (ASA).
There is a problem with named parameters with the Sybase driver in that the placeholders are prepended with an '@' *and* the execute method expects any dict paramers to have have keys that also have an '@'. I was able to get the placeholders generated correctly by subclassing the compiler. Any suggestions on how to get the execute method to work nicely or do I have to do some much around with copying parameters or monkeypatching the Sybase module with an implementation of execute that will work with 'ordinary' dictionaries? pjjH Error message is like this one .. note how the keys in the param dict do not start with an '@' There is no host variable corresponding to the one specified by the PARAM datastream. This means that this variable 'type_1' was not used in the preceding DECLARE CURSOR or SQL command. 'SELECT sysobjects.name \nFROM sysobjects \nWHERE sysobjects.name = @name_1 AND sysobjects.type = @type_1' {'type_1': 'U', 'name_1': 't1'} class SybaseSQLCompiler_Sybase(SybaseSQLCompiler): def __init__(self, *args, **params): super(SybaseSQLCompiler_Sybase, self).__init__(*args, **params) # This is a bit tedious: the Sybase module (i.e. the thing # that you get when you say 'import Sybase') names its # placeholders as '@foo'. if self.dialect.paramstyle == 'named': self.bindtemplate ="@%(name)s" --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---