开发者

Database Library/ORM mapper without configuration

开发者 https://www.devze.com 2023-03-09 19:08 出处:网络
I\'m currently planning an application that does work on an object relational database. The work is simple: just fetch data, analyse it, display it to the user and write back some changes. To support

I'm currently planning an application that does work on an object relational database. The work is simple: just fetch data, analyse it, display it to the user and write back some changes. To support a wide range of databases I'm currently searching for access library that meets all (or at least some) of the following requirements (sorted by importance):

  • Java or Python. I'm using Jython, so both is possible but I would prefer Python over Java

  • Return metadata about the database. I need to be able to fetch a list of all tables and their schema. Ideally, this information is given back as objects.

  • ability to fetch a record from multiple tables using a

  • complete runtime configuration from code. I don't want something that need i.e. a mapping开发者_开发百科 configuration in some XML file.

  • some kind of ORM mapping. I could live without it, but it would be nice to have. I would be totally okay if I get a bunch of objects with data in them and had to do the rest by reflection.

What is the best library for such a task (given that at least one exists ;) ).


You could use SQLAlchemy which uses zxJDBC on Jython. Django can also run on Jython, so that's another option. Both let you use Python to declare your models. Django's ORM is a bit less verbose, while SQLAlchemy is arguably more powerful, and tends to offer finer control. There is also a nice declarative wrapper for working with SQLAlchemy called Elixir.

0

精彩评论

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

关注公众号