In the PyDO distribution, there are a number of scripts called
somethinggenscript.py. What these scripts do, is
login to the database, and ask the database about the schema (read as:
grovel over the system catalogs), and ask the user (that is, you) a
few questions about what it finds, and what to call things. Then,
they output a python module containing premade PyDO classes that
contain the knowledge of the schema it produced. Currently genscripts
exist for Oracle (ogenscript.py, PostgreSQL
pgenscript.py and SAPDB sabdbgenscript. They are a
great way to automate something that would otherwise be tedious (at
least) and errorprone. Not only that, but occasionally, you wind up
discovering relations in your schema that you werent aware of.
In order for these tools to be able to gather relation information,
the appropriate referential integrity constraints must be in place.