By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,688 Members | 1,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,688 IT Pros & Developers. It's quick & easy.

using dejavu-orm

yoohoow
P: 4
Is any body use dejavu object relational mapper? I follow the dejavu pdf tutorial and try to run the example code . it's bad.
Expand|Select|Wrap|Line Numbers
  1.  
  2. import dejavu
  3. class Zoo(dejavu.Unit):
  4.     Name = dejavu.UnitProperty()
  5.     Size = dejavu.UnitProperty(int)
  6.  
  7.     def total_legs(self):
  8.         return sum([x.Legs for x in self.Animal()])
  9. class Animal(dejavu.Unit):
  10.     Legs = dejavu.UnitProperty(int, default=4)
  11. Animal.set_properties({"Name": unicode,
  12.                        "ZooID": int,
  13.                        })
  14. Animal.many_to_one('ZooID', Zoo, 'ID')
  15. # Set up a global Arena object.
  16. arena = dejavu.Arena()
  17. conf = {u'Connect': r"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\zookeeper.mdb;"}
  18. arena.add_store("main", "access", conf)
  19. arena.register_all(globals())
  20.  
I don't know "self.Animal()" what it means. why it can write as such?
and
how do I write the code if I want to connect sqlite db?
Jul 22 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.