5 ms·
SQLAlchemy is great, but for those who are looking for something lighter, I highly recommend Peewee (https://github.com/coleifer/peewee https://github.com/colei
by csytan 11y ago
SQLAlchemy is great, but for those who are looking for something lighter, I highly recommend Peewee (https://github.com/coleifer/peewee https://github.com/coleifer/peewee). It's a very well maintained alternative.
- mpdehaan2 11y agoI 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 https://github.com/coleifer/peewee/blob/master/peewee.py
- mhd 11y agoBetween 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.
- mpdehaan2 11y agoIf 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 :)
- collyw 11y agoI 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)
- mhd 11y agoMaybe 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.
- dalke 11y agoThat 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.
- coleifer 11y agoA 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 http://docs.peewee-orm.com/en/latest/peewee/playhouse.html
- hatchoo 11y agoSeconding the peewee recommendation. I usually go with Peewee for lightweight needs.
- Ayaz 11y agoYup. I consider SQLAlchemy heavy-duty. For light use, Peewee is extremely easy to use and quick to set up.
- odonnellryan 11y agoPeeWee and the maintainer Charles Leifer are both very awesome.
- coleifer 11y agoThanks!
- odonnellryan 11y agoHey 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 :)
- bunnybender 11y agoThere is also Ascetic (https://bitbucket.org/emacsway/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 https://bitbucket.org/emacsway/sqlbuilder) by the same author.