Django Reverse-Engineer from Existing Legacy Tables

By Ian Darwin on 2008-10-04 16:12 in Category: java python web

I've been playing a bit with Django, a Python-based web framework. One thing that people starting in Django seem to miss out on is the standard "how to I make model classes from my existing database tables"? That's not because you can't do this, but only because most of the newb tutorials start from the other end. It turns out that you can do this easily using "manage.py inspectdb". And you're done, at least most of your work is done. This reverse engineering is not as complete as that in Seam (actually Hibernate) - no compound primary keys, and (presumably because Python's db support is less general than Java's JDBC) it only works on a few databases (PostgreSQL, MySQL and SQL Server, IIRC), but for those database it does the bulk of the work for you.

So, this post is a bit away from my usual topics. I admit it, I'm mainly posting this here in hopes that somebody else using a web search will find the answer more quickly.
Twitter logo RSS/Atom Feed Icon
Categories Cloud