def test_uuid_key(self):
        u1 = UuidKey()
        u2 = UuidKey()
        self.session.add(u1)
        self.session.add(u2)
        self.session.commit()
        self.assertTrue(isinstance(u1.id, uuid.UUID))
        self.assertTrue(isinstance(u2.id, uuid.UUID))
        self.assertNotEqual(u1.id, u2.id)

        fk1 = UuidForeignKey1(uuidkey=u1)
        fk2 = UuidForeignKey2(uuidkey=u2)
        db.session.add(fk1)
        db.session.add(fk2)
        db.session.commit()

        self.assertIs(fk1.uuidkey, u1)
        self.assertIs(fk2.uuidkey, u2)
        self.assertTrue(isinstance(fk1.uuidkey_id, uuid.UUID))
        self.assertTrue(isinstance(fk2.uuidkey_id, uuid.UUID))
        self.assertEqual(fk1.uuidkey_id, u1.id)
        self.assertEqual(fk2.uuidkey_id, u2.id)
Models with a UUID primary key work as expected
dataset/ETHPy150Open hasgeek/coaster/tests/test_models.py/TestCoasterModels.test_uuid_key