This db.define_table(Field('uuid','id',default=uuid.uuid4()),....,
does not work because 'id' is expected to be integer. I think you would have to use keyed tables db.define_table(Field('uuid',default=uuid.uuid4()),...., primary_key=['uuid']) not all backends support this yet. I am not sure how well it works. Another option could be to use a function that makes a int uuid but one may run into size issues. Massimo On Apr 30, 4:12 pm, Brian M <bmere...@gmail.com> wrote: > Is there anyway to use the DAL with a database that used UUIDs as the > primary key in a few tables? The setup below just gives errors > because registered_user.UserId (the id field) isn't an integer as > expected (ValueError: invalid literal for int() with base 10: > '6BBC2607-1B6A-4C8A-BBD4-8566754CFA20') > > #Table: registered_user > #Stores user profiles > #Yeah I know this isn't web2py's Auth table - I'm integrating with > a .NET app. > db.define_table("registered_user", > Field("UserId","id", length=64, default=uuid.uuid4()), > Field("first_name", "string", notnull=True), > Field("last_name", "string", notnull=True), > Field("street", "string", notnull=True), > Field("city", "string", notnull=True), > Field("state", "string", notnull=True), > Field("zip", "string", notnull=True), > Field("lastUpdatedDate", "datetime", default=datetime.now(), > notnull=False), > migrate = do_migration > ) > > #Table: group_leader > #Stores the leader(s) of each group > db.define_table("group_leader", > Field("group_leader_id", "id"), > Field("group_id",db.volunteer_group), > Field("UserId",db.registered_user), > migrate = do_migration > ) > > Thanks in advance. > ~Brian