Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ccampbell/storm
Simple ORM for Tornado
https://github.com/ccampbell/storm
orm python storm tornado
Last synced: about 1 month ago
JSON representation
Simple ORM for Tornado
- Host: GitHub
- URL: https://github.com/ccampbell/storm
- Owner: ccampbell
- License: mit
- Created: 2013-09-28T21:01:35.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-17T00:16:42.000Z (about 9 years ago)
- Last Synced: 2024-08-09T21:18:48.878Z (3 months ago)
- Topics: orm, python, storm, tornado
- Language: Python
- Size: 213 KB
- Stars: 8
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Storm
### A simple ORM for Tornado
Storm stands for **S** imple **T** ornado **O** bject **R** elational **M** apping.
It uses Mongo DB for the backend, but it should be swappable for any storage by implementing the `storm.db.Database` interface.
This is the result of a few hours of work so I would not recommend using it in production at the moment.
## Usage
```python
from storm.model import Model
from storm.db import Connection
from storm.mongodb import MongoDb
from tornado.gen import coroutine
from tornado.ioloop import IOLoopclass User(Model):
pass@coroutine
def main():
db = MongoDb(Connection(
host='localhost',
port=27017,
database='test'))db.connect()
Model.set_db(db)
# save a new object
user = User()
user.name = 'Craig'
user.type = 'basic'
id = yield user.save()# find an object
try:
user = yield User.find(name='Craig')
print user.name
print user.type
except Exception, e:
print eIOLoop.instance().stop()
main()
IOLoop.instance().start()
```## Note
This is in no way affiliated with the storm ORM developed by Canonical: http://storm.canonical.com. I didn't know there was another ORM with the same name until I checked PyPi.