Python libraries to construct classes from a relational database? (ORM in reverse)

Are there any Python object-relational mapping libraries that, given a database schema, can generate a set of Python classes? I know that the major libraries such as SQLObject, SQLAlchemy, and Django's internal SQL ORM library do a very good job of creating a DB schema given a set of classes, but I'm looking for a library that works in reverse.

There is a related question for Perl libraries on Stack Overflow.

Answers


SQLAlchemy extension to create a python code model from an existing database


Django had an inspectdb command that creates models.py files out of your database.


SQLAlchemy can actually do what you want. You can either define the mappings yourself manually using the mapper facility, or auto-generate them using reflection.

It's not absolutely necessary to build the database using the metadata facility, you can always use an existing one instead.


Geniusql (and Dejavu, its big federated brother) can do that quite well. See "Automatic Table Classes" for the former and "Automatic Unit Classes" for the latter.


Need Your Help

Code coverage setup for Unit tests target

unit-testing gcc code-coverage gcov

I am facing one issue regarding code coverage setup for Unit tests. I created unit test target for my project. Generate Test Coverage Files and Instrument Program Flow i made it YES for the Unit t...

How do you specify only one option on a filter, such as FILTER_INT

php filter options

I've seen trillions (okay, perhaps not trillions but at certainly billions) of examples of using the various PHP filters with an array of options but I haven't see how you specify just one option.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.