Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

SQLAlchemy is great, but for those who are looking for something lighter, I highly recommend Peewee (https://github.com/coleifer/peewee). It's a very well maintained alternative.


I haven't tried it, but the choice to include the entire application in one file is ... interesting.

https://github.com/coleifer/peewee/blob/master/peewee.py


A lot of folks may not know, but Peewee has a large "contrib" package full of db-specific extension modules and other neat things called `playhouse`. If you use `pip` to install peewee or clone it from GitHub, the `playhouse` modules are included. So while yes, Peewee is a single module, there are lots of extension modules that add a ton of functionality [1].

1: http://docs.peewee-orm.com/en/latest/peewee/playhouse.html


Between that, bottle and maybe sqlite, you've got your whole setup in a directory without requiring modules, packagers etc. That can be a big boon for internal or embedded stuff, when you don't have total control over your environment.


I can't think of an example of when you would want "embedded stuff" running a webserver. Do you have any examples? (Not saying its not needed, but I am struggling to see where)


Maybe not the apocryphal Forth washing machine controller, but components used in automation often employ web servers for remote configuration and statistics. If it isn't a PLC (although there are some devices that basically mix a small embedded RT PC with a PLC). Connect to the device via ethernet, and the device then communicates with a machine through some kind of bus.

If you've got wifi/ethernet, configuration through web servers comes naturally.


If you're just looking to distribute, you could use git submodules and point at any package that way.

git checkout --recursive, etc.

Or just a symlink and include it in your setup.py. Or check it out inside your project.

Still allows better organized code. Given, the alternatives are very metaclass heavy black magic, and sometimes spare on comments - actually nearly all ORMs are very heavy on the black magic :)


That made it very convenient for me recently. I had a contract that did a bunch of data analysis. The last step is to upload the results into either MySQL or SQLite database. I used peewee.py, plus some code from playhouse/db_url.py, and got it working.

Even without using the ORM part, the database objects have information to help me roll my own cross-database SQL calls using a bit of string substitution so "?" becomes "%s", etc.


PeeWee and the maintainer Charles Leifer are both very awesome.


Thanks!


Hey man! Great work and thanks so much for so diligently answering all your user's questions. You're an inspiration for sure, and I've learned a good deal just reading over some of your code :)


Seconding the peewee recommendation. I usually go with Peewee for lightweight needs.


There is also Ascetic (https://bitbucket.org/emacsway/ascetic), which looks pretty minimal. So far I've been keeping it simple and have only been using SQLBuilder (https://bitbucket.org/emacsway/sqlbuilder) by the same author.


Yup. I consider SQLAlchemy heavy-duty. For light use, Peewee is extremely easy to use and quick to set up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: