diff options
author | Martijn Pieters <mjpieters@fb.com> | 2017-11-22 10:05:44 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-12-15 09:53:04 -0500 |
commit | c0d2d9b8bda7d8abd3af74fa51defdc30cb06725 (patch) | |
tree | 5f4fa3d5612987f52cd1b7ede8aeace4f4044185 | |
parent | 4cf0fb2e5591eac245c4020c3c8b7fef57e2f969 (diff) | |
download | sqlalchemy-c0d2d9b8bda7d8abd3af74fa51defdc30cb06725.tar.gz |
Allow for the database to produce a UUID instance
Some database adapters (specifically, pg8000) already produce a uuid.UUID()
instance for UUID columns. Account for this.
(cherry picked from commit e80a5adfd406e2392cfaad687e8b3f0ae9ed4e11)
-rw-r--r-- | doc/build/core/custom_types.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/build/core/custom_types.rst b/doc/build/core/custom_types.rst index 2c3784b97..54a8daeac 100644 --- a/doc/build/core/custom_types.rst +++ b/doc/build/core/custom_types.rst @@ -163,7 +163,9 @@ binary in CHAR(16) if desired:: if value is None: return value else: - return uuid.UUID(value) + if not isinstance(value, uuid.UUID): + value = uuid.UUID(value) + return value Marshal JSON Strings ^^^^^^^^^^^^^^^^^^^^^ |