Amber: [CLI] Add new 'inspectdb' command for database introspection

Created on 31 Jan 2018  路  7Comments  路  Source: amberframework/amber

First I started asking for this enhancement here: https://github.com/amberframework/granite-orm/issues/119

It would be very helpful in Amber to connect to a database to build a whole scaffolding.

It could be work like this:

amber inspectdb

and it will print the content of models file.

Use amber inspectdb Author Book to only have the table Author and Book.

It would be interesting to also give the specific database you want to use (development, production, etc.).

I found this kind of functionnality here: https://docs.djangoproject.com/en/2.0/ref/django-admin/#inspectdb

Believe me, it's very very very helpful! For any database I want to generate a graph, I create a django project, inspect the database, then use graph_model command to generate a PNG ^_^.

In fact, with this inspectdb command you can start quickly on any project (that doesn't use Amber) and be productive with Amber by creating a website or just an admin interface.

cli

Most helpful comment

Interesting idea, I can see how that would be helpful. I think that might be good to nest under the db subcommand: amber db inspect

All 7 comments

Is there any progress? If no one has started yet, I will try it. Because I need this ASAP. 馃槃

You can try this but its not perfect. It just tries to run scaffolding on all the fields. It generates duplicate timestamps and id's need some adjusting. https://github.com/drujensen/db_scaffold

@drujensen
Wow, great work! You prevented me from wasting time. Thank you! 馃樅

Interesting idea, I can see how that would be helpful. I think that might be good to nest under the db subcommand: amber db inspect

@drujensen do you think we can have your shard built into amber and have a amber db scaffold command?

@eliasjpr yes, I will take a stab at it when I get a chance.

Decided against providing this in Amber. you can use my shard to kickstart an existing project from a database.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faustinoaq picture faustinoaq  路  4Comments

netwarp picture netwarp  路  6Comments

jaysneg picture jaysneg  路  5Comments

bigforcegun picture bigforcegun  路  3Comments

eliasjpr picture eliasjpr  路  6Comments