[storm] Compound foreign key

Gerdus van Zyl gerdusvanzyl at gmail.com
Tue Aug 26 09:05:58 BST 2008


How do I create a compound foreign key referenceset?

I want a invoice detail refset on the invoiceBase class.

Currently I use a uuid as a surrogate foreign key but I worry about
possible performance when the database grows large.
invoicedetail = ReferenceSet(invoiceBase.ck, invoicedetailBase.ck)

What is the lists opinion on using uuid's as primary and foreign keys?

thank you,
Gerdus van Zyl

--
class invoiceBase(bizstorm):
    __storm_table__ = "invoice"
    __storm_primary__ = "invoiceno","locationno"
    # invoiceno is generated using a sequence and trigger on insert
    ck = dcUnicode()
    locationno = Int(allow_none=False)
    custno = Int()
    invoiceno = Int()
    empno = Int()
    computerno = Int()
    total = dcDecimal()



class invoicedetailBase(bizstorm):
    __storm_table__ = "invoicedetail"
    __storm_primary__ = "invoicedetailno"

    ck = dcUnicode()
    stockno = Int()
    price = dcDecimal()
    invoicedetailno = Int()
    qty = dcDecimal()



More information about the storm mailing list