Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Support UUID #39

Closed
Closed

Description

@zezic

Do you plan to support UUID type and allow it to be used as a primary key?

Activity

  1. thiagovarela commented on May 9, 2019

    @thiagovarela
    Contributor

    Hey, have you tried something like:

    # fields.py
    from sqlalchemy.dialects.postgresql import UUID
    class UUIDField(ModelField, typesystem.String):
        def get_column_type(self):
            return UUID()
    
    # models.py
    class Thingy(orm.Model):
        id = UUIDField(default=uuid4, format="uuid", primary_key=True)
  2. unittolabs commented on Jan 8, 2020

    @unittolabs

    @thiagovarela seems it's not enough
    when we use as_uuid=False we expect to get an str object from DB
    when we use as_uuid=True we expect to get uuid.UUID object from DB

    but actually we get asyncpg.pgproto.pgproto.UUID in any case.

    Can we implement something like a to_python method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions