Package: json-entity
simple-json-dbThis is a simple json database.
The package provides a simple ORM between python objects and
json objects with a well type-hinted schema.engine=AppEngine()asyncwithengine.studentsasstudents:students.add_range(Student("John","Doe"),Student("Jane","Doe"))asyncforstudentinengine.students:print(student.first_name,student.last_name)# Can you guess ? )This package maps your python objects to json and then you can save, get,
modify or delete them using async methods.This package is for tiny and simple projects. with a low amount of data.InstallationThe package is available atPYPIas json-entity.IntroLet's see how you can get started with the package.See also ourWiki.You can take a look atsrc/examples, if you're not on reading mode.Quick StartThis data base consist of 3 main elements:1-ModelIt's obvious that you should have a model for your data to save, update, or ...

Since this library works with json, your model can contain everything
that JSON can.2-CollectionYou have a collection of data for every model, therefor,
The relation between Model and Collection is one to one.3-EngineThis is where all collections are operate.So, EveryEnginehas someCollections where each collection
contains a set of an uniqueModel.Let's create a modelModels are simple python class.fromsjdimportTEntity,Engine,propertiesasprops@props.auto_collect()classPerson(TEntity):def__init__(self,first_name:int,last_name:str,age:int):self.first_name=first_nameself.last_name=last_nameself.age=ageUsingauto_collect()method,
the model will automatically collect properties form__init__method.Creating collection ?It's really not necessary to create a collection by your own!
And maybe you better )Let us do that for ya ( Of course you can create customized Collections ).Setup engineNow you need to setup database's engine and define your collections there.# ---- sniff ----classAppEngine(Engine):__db_path__="my_database"persons=Engine.set(Person)That's all you need to do for now.Fire upNow it's time for some fireworks 🎇.Since the package isasync, you'll need an event loop for it.importasyncio# ---- sniff ----asyncdefmain():...if__name__=="__main__":asyncio.run(main())Now you can work with database inside main function.asyncdefmain():engine=AppEngine()collection=engine.personsasyncwithcollection:collection.add_range(Person("John","Doe",20),Person("Jane","Doe",21),Person("Jack","jones",22),Person("Jill","jones",23),)Iterate over all persons in the collectionasyncforpersonincollection:print(person.first_name,person.last_name,person.age)You can do more advanced query stuff withqueryable context.asyncwithcollection.get_queryable()aspersons:asyncforpersoninpersons.where(lambdap:p.age>21):print(person.first_name,person.last_name,person.age)Or get only one directly.target=awaitcollection.get_first_async(lambdas:s.first_name,"John")You can easily update your data:asyncwithcollection.get_queryable()aspersons:asyncforpersoninpersons.where(lambdap:p.last_name=="jones"):person.last_name="Jones"awaitcollection.save_changes_async()Or even delete them ...asyncwithcollection.get_queryable()aspersons:asyncforpersoninpersons.where(lambdap:p.last_name=="Doe"):collection.delete(person)awaitcollection.save_changes_async()There're a lot more! seesrc/examples.