django rest make an api of database information schema -
how can make api show information schema
such columns name or tables name.
for showing column name wrote code:
class columnnameview(apiview): def get(self, request, format=none): rawquery="select column_name information_schema.columns table_schema = 'myschema' , table_name = 'mytable'" queryset=mytable.objects.raw(rawquery) response_data = {} response_list = list() in queryset: response_data["id"] = i.column_name response_list.append(response_data) return response(data=response_list)
but got error:
raw query must include primary key
and table name have no idea. advice thankful...
Comments
Post a Comment