Python lightweight database wrapper for SQLite

前端 未结 7 519
离开以前
离开以前 2021-02-01 15:01

Is there a lightweight database wrapper in Python that I can use for SQLite. I would like something like Django\'s ORM, but that I can just point to a database file and it\'ll m

7条回答
  •  执念已碎
    2021-02-01 15:24

    You can checkout RabaDB. It has arguably one of the simplest interfaces out there.

    class Human(R.Raba) :
            _raba_namespace = 'test_namespace'
    
            #Everything that is not a raba object is primitive
            name = rf.Primitive()
            age = rf.Primitive()
            city = rf.Primitive()
    
            #Only Cars can fit into this relation
            cars = rf.Relation('Car')
    
            #best friend can only be a human
            bestFriend = rf.RabaObject('Human')
    

    It is optimized to have little memory consumption, it supports queries by examples, inheritance, has debugging tools and even allows you to fall back onto SQL if needed.

提交回复
热议问题