Skip to content

Python JSON ORM (simple module all in one file)

Notifications You must be signed in to change notification settings

24greyhat/JSORM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JSORM

A simple json orm in python


1) Example:

from Model import Model, ModelField



class Person(Model):
    id = ModelField(int)
    name = ModelField(str)
    age = ModelField(int)
    rank = ModelField(float)



instance = Person()

instance.create(id=1, name="John Doe", age=20, rank=2.59)

results1 = instance.search("id", "1", limit=1)


results2 = instance.values("id", limit=100)


instance.update(name="id", value=1, new_value=2)


results3 = instance.values("id")


instance.exportModelZipFile(".")

Example Retrieving entire row:

class RowExample(Model):
    x = ModelField(int)
    y = ModelField(int)



w = RowExample()

w.create(x=10, y=20)
w.create(x=20, y=None)

print(w.getRow("x", 10)) # {'x': 10, 'y': 20}
print(w.getRow("x", 20)) # {'x': 10, 'y': None}

Releases

No releases published

Packages

No packages published

Languages