Skip to main content

Model based ORM in RAM

Project description

ramorm [Alpha]

Model based ORM in RAM. Made for performance. Please do not store critical data (yet)



pip install ramorm


from ramorm import orm, model

db = orm.Orm('my_test_database') 

class Vehicle(model.Model):
    name = model.TextField()
    wheels = model.IntegerField(default=4)
    max_speed = model.IntegerField(default=100)

sports_car = Vehicle(name='Aventador', max_speed=230)
print(,sports_car.wheels, sports_car.max_speed)
>> 'Aventador' 4 230

bicycle = Vehicle(name='Bicycle', wheels=2, max_speed=50)
print(bicycle.wheels, bicycle.max_speed)
>> 'Bicycle' 2 50

Add your model based objects to database using push function, you can pass one or multiple objects at once

db.push(sports_car, bicycle)

Retrieving single objects from database is possible using get function

print(db.get(Vehicle, wheels=4).name)
>> 'Aventador'

print(db.get(Vehicle, name='Bicycle').max_speed
>> 50

For filtering numerical parameters you can use __gt (greater), __gte (greater or equal), __lt (lower), __lte(lower or equal)

print(db.get(Vehicle, max_speed__gt=70).name)
>> 'Aventador'

For retrieving multiple objects at once use filter

for vehicle in db.filter(Vehicle, max_speed__gte=10):
    print(, vehicle.wheels, vehicle.max_speed)
>>  'Aventador' 4 230
>>  'Bicycle' 2 50

For deleting objects from db use delete function. Returns True if changes were made to database

db.delete(Vehicle, name='Bicycle')
>> True
db.delete(Vehicle, name='Starship')
>> False

If you want completely delete all data in your database use drop .Returns array of objects in db (empty)

>> []

Coming soon

  • [ ] Delete objects using .delete()

  • [ ] Order by

  • [ ] Backup to file

  • [x] PyPI package

  • [ ] Integration with postgresql, redis

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ramorm, version 0.0.11
Filename, size File type Python version Upload date Hashes
Filename, size ramorm-0.0.11-py3-none-any.whl (6.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ramorm-0.0.11.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page