This may help in addition to Jonathan's suggestion. In PostgreSQL when you create a serial field for that purpose it actually creates an integer field with a modifier similar to this: not null default nextval(('"dl_articlereq_id_seq"'::text)::regclass)
where dl_article is the table in which id is the integer field created. Also created is a sequence with this format: sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called --------------------------------+------------+------------------------+------------------+---------------+-------------------+-----------+---------------+----------- dl_articlereq_id_seq | 288 | 1 | 2147483647 | 1 | 1 | 0 | f | t so you can get the last record value from last_value field. I'm feel sure mySQL is similar. Hope you can use this. Thomas On Thursday 14 August 2008 04:40, Phillip B Oldham wrote: > Hi all. I'm playing with standalone ZODB at the moment trying to get a > better understanding of its use in applications. I come from a > PHP/MySQL background, and I'm taking my first steps with Python at the > same time. > > One of the things I'm not understanding about ZODB is assigning > incremental IDs to objects. For instance, if I were to be writing a > support-ticket system I'd want to give each ticket a unique number, > but one that's "human-useable" (otherwise you could just use a UUID - > try giving one of those over the phone!). > > Also, how would one add a new item to the db in this way? > > For instance: > > class Ticket(Persistence): > def __init__(self): > self.id = '' # How do I add a new incremental ID here? > > # and later on in the app > > tkt = Ticket() > dbroot[?????] = tkt > > How would one assign a unique ID to the root at that point? -- ==================================================================== Thomas McMillan Grant Bennett Appalachian State University Operations & Systems Analyst P O Box 32026 University Library Boone, North Carolina 28608 (828) 262 6587 "... using OpenOffice.org, and save them back to disk automatically, in MS Word format. They surf the Web, check e-mail, do instant messaging, view YouTube videos, visit their Facebook pages, learn touch-typing skills and lots more. Our public library has been offering these Linux public stations for the past three years." - Phil Shapiro Linux Journal January 2008 Library Systems Help Desk: https://www.library.appstate.edu/help/ ==================================================================== _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )