Found the answer:

# a function to create primary key ids
i = 0
def mydefault():
    global i
    i += 1
    return i

t = Table("mytable", meta,
    # function-based default
    Column('id', Integer, primary_key=True, default=mydefault),

    # a scalar default
    Column('key', String(10), default="default")
)

Thanks,

VJ

On Feb 13, 1:18 pm, "vinjvinj" <[EMAIL PROTECTED]> wrote:
> I use the mx.UID package to generate all my keys. Is there any way to
> specify that this function be called to generate the primary key for
> inserts?
>
> Thanks,
>
> VJ

On Feb 13, 1:18 pm, "vinjvinj" <[EMAIL PROTECTED]> wrote:
> I use the mx.UID package to generate all my keys. Is there any way to
> specify that this function be called to generate the primary key for
> inserts?
>
> Thanks,
>
> VJ


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to