document reflection + custom types

Issue #2519 new
Former user created an issue

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)

  1. Log in to comment