using dejavu-orm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoohoow
    New Member
    • Jul 2012
    • 4

    using dejavu-orm

    Is any body use dejavu object relational mapper? I follow the dejavu pdf tutorial and try to run the example code . it's bad.
    Code:
    import dejavu
    class Zoo(dejavu.Unit):
        Name = dejavu.UnitProperty()
        Size = dejavu.UnitProperty(int)
       
        def total_legs(self):
            return sum([x.Legs for x in self.Animal()])
    class Animal(dejavu.Unit):
        Legs = dejavu.UnitProperty(int, default=4)
    Animal.set_properties({"Name": unicode,
                           "ZooID": int,
                           })
    Animal.many_to_one('ZooID', Zoo, 'ID')
    # Set up a global Arena object.
    arena = dejavu.Arena()
    conf = {u'Connect': r"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\zookeeper.mdb;"}
    arena.add_store("main", "access", conf)
    arena.register_all(globals())
    I don't know "self.Anima l()" what it means. why it can write as such?
    and
    how do I write the code if I want to connect sqlite db?
Working...