On Sun, Mar 31, 2019 at 10:12 PM Ian Wagner <
ianthe...@gmail.com> wrote:
>
>
> My suggestion would be a pymssql dialect-level patch to send bytestrings for String columns, and of course continue passing str/unicode for Unicode columns. I'm on the mailing list looking for help with why my solution doesn't work as intended with enums (see my GitHub repo). For the moment, I've actually just implemented this column myself as shown, and replaced all String columns with it (rather than "replacing" String using colspecs), and banned all devs on our project from using the regular String column type until it's fixed.
Please just use a TypeDecorator for all your String columns where this
issue is apparent:
class UTF8String(TypeDecorator):
impl = String
def process_bind_param(self, value, dialect):
if value is not None:
value = value.encode(dialect.encoding)
return value
next, the issue should be reported to pymssql, where they should
likely include options to modify this behavior:
https://github.com/pymssql/pymssql
next, I need this to be confirmed as an issue for pyodbc. As my
understanding is that Microsoft is funding Pyodbc's development I'd
like to see what their approach to this issue is.
*if* it is truly the canonical solution that applications that code
against these DBAPIs *must* send byte arrays in order to avoid
crushing performance costs, the drivers need to make that clear.
then we can look into introducing either flags or permanent behavior
such that we encode all Python unicode objects for a *non unicode*
String datatype under the MSSQL dialects.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sqlalchemy+...@googlegroups.com.