MCPcopy Create free account
hub / github.com/explorerhq/sql-explorer / get

Method get

explorer/views/schema.py:21–39  ·  view source on GitHub ↗
(self, request, *args, **kwargs)

Source from the content-addressed store, hash-verified

19 return super().dispatch(*args, **kwargs)
20
21 def get(self, request, *args, **kwargs):
22 connection_id = kwargs.get("connection", default_db_connection_id())
23 try:
24 connection = DatabaseConnection.objects.get(id=connection_id)
25 except DatabaseConnection.DoesNotExist as e:
26 raise Http404 from e
27 except ValueError as e:
28 raise Http404 from e
29 schema = schema_info(connection)
30 if schema:
31 return render(
32 request,
33 "explorer/schema.html",
34 {"schema": schema}
35 )
36 else:
37 return render(request,
38 "explorer/schema_error.html",
39 {"connection": connection.alias})
40
41
42class SchemaJsonView(PermissionRequiredMixin, View):

Callers 1

getMethod · 0.45

Calls 2

default_db_connection_idFunction · 0.90
schema_infoFunction · 0.90

Tested by

no test coverage detected