home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 894925914

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/1421#issuecomment-894925914 https://api.github.com/repos/simonw/datasette/issues/1421 894925914 IC_kwDOBm6k_c41V3xa 9599 2021-08-09T03:20:42Z 2021-08-09T03:20:42Z OWNER I think this works! ```python _re_named_parameter = re.compile(":([a-zA-Z0-9_]+)") async def derive_named_parameters(db, sql): explain = 'explain {}'.format(sql.strip().rstrip(";")) possible_params = _re_named_parameter.findall(sql) try: results = await db.execute(explain, {p: None for p in possible_params}) return [row["p4"].lstrip(":") for row in results if row["opcode"] == "Variable"] except sqlite3.DatabaseError: return [] ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 959999095  
Powered by Datasette · Queries took 1.615ms