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

Method post

explorer/views/query.py:37–56  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

35 return self.render()
36
37 def post(self, request):
38 c = request.POST.get("database_connection", default_db_connection_id())
39 show = url_get_show(request)
40 sql = request.POST.get("sql", "")
41
42 query = Query(sql=sql, title="Playground", database_connection_id=c)
43
44 passes_blacklist, failing_words = query.passes_blacklist()
45
46 error = MSG_FAILED_BLACKLIST % ", ".join(
47 failing_words
48 ) if not passes_blacklist else None
49
50 run_query = not bool(error) if show else False
51 return self.render_with_sql(
52 request,
53 query,
54 run_query=run_query,
55 error=error
56 )
57
58 def render(self):
59 return self.render_template(

Callers

nothing calls this directly

Calls 6

passes_blacklistMethod · 0.95
render_with_sqlMethod · 0.95
default_db_connection_idFunction · 0.90
url_get_showFunction · 0.90
QueryClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected