8000 MySQL - "'ascii' codec can't encode character" with accentuated character in the table name · Issue #37 · unalloc/sqlautocode · GitHub
[go: up one dir, main page]

Skip to content
MySQL - "'ascii' codec can't encode character" with accentuated character in the table name #37
Open
@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Create a table with an accentuated character in the name, like "pdf_imprimé"
2. run sqlautocode

What is the expected output? What do you see instead?
$ sqlautocode mysql://[...]/db -d -e -o model.py
saac.decl - INFO - Reflecting database...
[...]
saac.decl - DEBUG - Creating Model from table: pdf_imprimé
Traceback (most recent call last):
  File "/usr/local/bin/sqlautocode", line 9, in <module>
    load_entry_point('sqlautocode==0.7', 'console_scripts', 'sqlautocode')()
  File "/usr/local/lib/python2.6/dist-packages/sqlautocode/main.py", line 21, in main
    emit(repr(factory))
  File "/usr/local/lib/python2.6/dist-packages/sqlautocode/declarative.py", line 143, in __repr__
    models = self.models
  File "/usr/local/lib/python2.6/dist-packages/sqlautocode/declarative.py", line 192, in models
    self._models.append(self.create_model(table))
  File "/usr/local/lib/python2.6/dist-packages/sqlautocode/declarative.py", line 234, in create_model
    class Temporal(self.DeclarativeBase):
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/ext/declarative.py", line 1336, in __init__
    _as_declarative(cls, classname, cls.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/ext/declarative.py", line 1329, in _as_declarative
    **mapper_args)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/__init__.py", line 1116, in mapper
    return Mapper(class_, local_table, *args, **params)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/mapper.py", line 201, in __init__
    self._configure_properties()
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/mapper.py", line 851, in _configure_properties
    setparent=True)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/mapper.py", line 1139, in _configure_property
    prop.instrument_class(self)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/properties.py", line 111, in instrument_class
    doc=self.doc
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/attributes.py", line 1293, in register_descriptor
    manager.instrument_attribute(key, descriptor)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/instrumentation.py", line 182, in instrument_attribute
    self.install_descriptor(key, inst)
  File "/usr/local/lib/python2.6/dist-packages/sqlalchemy/orm/instrumentation.py", line 236, in install_descriptor
    setattr(self.class_, key, inst)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 
20: ordinal not in range(128)


What version of the product are you using? On what operating system?
Python 2.6.5 on Linux (I have the same problem with Python 2.7.1 on Windows)
sqlautocode-0.7

Please provide any additional information below.
I also use columns with accentuated characters.

Original issue reported on code.google.com by bigras.b...@gmail.com on 6 Feb 2012 at 3:07

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0