- changed title to document reflection + custom types
- changed milestone to 0.7.9
document reflection + custom types
Issue #2519
new
I am using the guid type as my id field when I create a table on a mysql database with the mysqlconnector library. Everything works fine, and I insert my data with guids. Later, I open a new connection and reflect the table from the server with:
self.t = Table('extras', metadata, autoload=True, keep_existing=True)
However, when I attempt to insert into the table after reflection, I get an exception:
(ProgrammingError) Failed processing pyformat-parameters; <class 'uuid.UUID'>
I can fix this by overriding the id field when I run the reflection, but I am unsure why this would occur. My best guess is that sqlalchemy has no way to "match back" if a CHAR had a special wrapper type when originally created, which is understandable.
I would suggest making it clear in the docs that special wrapper classes, while useful, do not reflect as one may expect.
Comments (3)
-
repo owner -
repo owner - changed milestone to 0.x.xx
-
repo owner - changed milestone to 1.x.xx
- Log in to comment
yeah we have yet to have a totally endorsed way to override these types, though the way that is smoothest right now is to use the
column_reflect
event: http://docs.sqlalchemy.org/en/rel_0_7/core/events.html?highlight=column_reflect#sqlalchemy.events.DDLEvents.column_reflect