Take index type into account in inspectdb command

131 views
Skip to first unread message

akki

unread,
Aug 17, 2016, 12:01:51 PM8/17/16
to Django developers (Contributions to Django itself)
Hi

Currently the inspectdb command doesn't take the database indexes into account (Ticket - #27060). While working on adding this feature, there was some confusion related to the inclusion of the index type.


I have implemented this feature here but since Django doesn't support introspection of the type of index, currently the generated models have the default (B-tree) index no matter what the type of the actual index in the database may be. So I would like seek some advice on whether it would be a good idea to move ahead with this approach with a comment at the beginning of the generated file with the other comments and integrate this basic implementation into Django (with an update on the ticket and keeping the ticket open, maybe?).

Or should this be kept on a hold until Django supports introspection of the index type for it's backends (PostgreSQL has this feature with some concerns about the design) and be done correctly all at once. Once that happens we would either use the correct index type if it is supported by Django, else add a comment informing that the index type is not a match and should be created manually.


Please let me know if any other clarification is required on this. Thanks for any help.

Regards
akki

Tim Graham

unread,
Aug 19, 2016, 11:33:00 AM8/19/16
to Django developers (Contributions to Django itself)
I think if we do a similar thing like we do for field introspection (outputting a comment like "# This field type is a guess" next to unknown fields) it would be okay. The comment might say the backend doesn't support index type introspection. Let's put out a call for help to try to get index introspection done on the other databases for 1.11.

akki

unread,
Aug 25, 2016, 9:03:45 AM8/25/16
to Django developers (Contributions to Django itself)
Ticket to add support for introspection of index type - https://code.djangoproject.com/ticket/27097
Reply all
Reply to author
Forward
0 new messages