I see, so I didn't quite understand the relationship between sqlalchemy and 
the sqlalchemy_utils libraries, but I think I've got it all straight now. 
 To answer your question as to why I would need the dashes, it's because 
the other dependencies expect to be able to look up uuid by the standard 
format.  At any rate, I've got it fixed now, thanks so much Mike!

On Friday, July 29, 2016 at 6:45:01 PM UTC-7, Jason Libbey wrote:
>
> Hi, this is my first post, so if it does not adhere by your guidelines, 
> please let me know and I'll fix it ASAP.
>
> I'm using the sqlalchemy_utils.UUIDType as per backend-agnostic-guid-type 
> <http://docs.sqlalchemy.org/en/latest/core/custom_types.html#backend-agnostic-guid-type>
> .
>
> from sqlalchemy_utils import UUIDType
>
>
>
> class ApplicationStore(Base, Timestamp):
>
>     __tablename__ = 'applications'
>
>     id = Column(UUIDType(binary=False), primary_key=True, default=uuid.uuid4)
>
>     user_uuid = Column(UUIDType(binary=False), unique=True, index=True, 
> nullable=False)
>
>
>
> Since I am using a mysql db, the UUIDType is correctly falling back to the 
> CHAR32 representation.  However, the value that gets written to the db is 
> the uuid with no dashes.
>
>
> application = application_service.create(user_uuid=uuid.uuid4())
>
>
>
> The string representation of the uuid shows it with dashes, but the 
> database char is saved without dashes.  So my questions are:
> 1. Am I using this correctly?
> 2. Is this the expected behavior?
> 3. How can I force it to save as uuid with dashes, while still using the 
> backend agnostic guid type?
>
> Python version: 2.7.10
> SQLAlchemy version: 1.0.12
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to