简体   繁体   中英

Database Library/ORM mapper without configuration

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 ie 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM