unicode identifiers in sqlsoup

Issue #821 resolved
jek created an issue

unicode table names / selectable names need to be string encoded before generating classes for mapping.

Comments (13)

  1. Former user Account Deleted

    I've found this problem when I load all tables from the database with metadata.reflect To solve it I changed the line from sqlsoup.py 420 mapname = 'Mapped' + _selectable_name(selectable) to 420 mapname = unicode('Mapped' + _selectable_name(selectable)).encode() Converting to unicode and encoding it back to a string should assure that even if the selectable name is a string, nothing breaks.

    Can someone check if it can be merged into trunk?

  2. jek reporter

    do you have a test case that triggers this behavior? one of the reasons this ticket has been quiet is that i can't replicate the behavior. i don't doubt that it happens, i just can't seem to trigger it in the way that's been reported off and on in the irc channel.

  3. Former user Account Deleted

    I've attached a test case which in my machine (with a trunk install of sqlalchemy, pyodbc and sql server 2005) results in the described behavior. It also exposes another problem with metadata, I think. But I'm not so sure of that one, or how it should be solved inside sqlsoup

  4. Former user Account Deleted

    i encouter this problem. May the fix not match my use case. I'll attach to this bug the temporary workaround i'm using

  5. Former user Account Deleted

    applied the second proposed fix (the one in the diff), with a minor change to make it affect all selectables, not just tables.

  6. Former user Account Deleted

    MY bad, i reopened the ticket, sorry.

    For the bug, i confirm that it is fixed with the current trunk (rev 5211)

  7. Log in to comment