How to automate database table access as objects and provide common operations, like CRUD and views integraion? I think this is a pretty normal use-case: Developer has a database. Tables and columns have meaningful names and helpful comments, possibly also sane set of relations. Now he needs a module to be build on it.

Is there any automated way to provide CRUD and views integration, either dynamically or by creating a module backbone for developers to edit? Like scaffolding available in Cake PHP and other frameworks and languages? Doing it by hand for large number of tables is repetitive and boring, and that's both waste of time and source of errors.
Automatically, no (although if someone want to prove that wrong I'd be delighted to see the solution). However, everything you've asked for is easily attainable through Drupal's API:


For the database table, implement hook_schema() (no foreign keys are enforced in Drupal 7, though the relationships can be described for documentation)
For views integration implement hook_views_data()
For CRUD forms use the form API.


I think the closest you'll get to doing that automatically is the Entity Construction Kit. You can define your custom data as an entity, and I believe that module will create the appropriate entity forms for you. Integration with the Entity API module and Views means you can also expose that data, and you get field functionality built right in.

However, going that route will probably end up taking more code than doing it manually, and the reliance on the entity/field system will introduce extra overhead.

You might also want to look at the Doctrine ORM module; I haven't used it before, and it's only in dev, but if you can get that working it would give you objects mapped to DB tables as you're looking for. Exactly how that would fit into Drupal I'm not sure.

Things in Drupal 8 should be much better.