I’d like to introspect the Django database(or table) at the runtime. So, for example- I’d like to do something like:
>>> a = django.db.introspect()
and now *a* should see like
a = {
'table_name1':{
'column_name_1_1':{
'index': True,
'unique': True,
'pk': True
},
'column_name_1_2':{
'index': True,
'unique': False,
'pk': False
}
},
'table_name2':{
'column_name_2_1':{
'index': True,
'unique': True,
'pk': True
},
'column_name_2_2':{
'index': True,
'unique': False,
'pk': False
}
}
}
And- I’d like to do that with Django & South and without any 3rd party tools(I know that I coul do that with SQLAlchemy). I want to introspect the actual db, not the frozen one in my last migration. Is that possible? How can I start?
I’ve found my answer- here is everything I need:
https://code.djangoproject.com/browser/django/trunk/django/core/management/commands/inspectdb.py