开发者

Lightweight Object->Database in Python

开发者 https://www.devze.com 2022-12-24 07:06 出处:网络
I am in need of a lightweight way to store dictionaries of data into a database. What I need is something that:

I am in need of a lightweight way to store dictionaries of data into a database. What I need is something that:

  1. Creates a database table from a simple type description (int, float, datetime etc)
  2. Takes a dictionary object and inserts it into the database (including handling datetime objects!)
  3. If possible: Can handle basic references, so the dictionary can reference other table开发者_运维技巧s

I would prefer something that doesn't do a lot of magic. I just need an easy way to setup and get data into an SQL database.

What would you suggest? There seems to be a lot of ORM software around, but I find it hard to evaluate them.


SQLAlchemy's SQL expression layer can easily cover the first two requirements. If you also want reference handling then you'll need to use the ORM, but this might fail your lightweight requirement depending on your definition of lightweight.


SQLAlchemy offers an ORM much like django, but does not require that you work within a web framework.


From it's description, perhaps Axiom is a pythonic tool for this .


Seeing as you have mentioned sql, python and orm in your tags, are you looking for Django? Of all the web frameworks I've tried, I like this one the best. You'd be looking at models, specifically. This could be too fancy for your needs, perhaps, but that shouldn't stop you looking at the code of Django itself and learning from it.

0

精彩评论

暂无评论...
验证码 换一张
取 消