docs: def insert_query(**kw):
      """
      Insert a query name for a node_id.
      `name`
      `node_id`
  
      Adds the name to the Query table if not already there. Sets the query field
      in Node table.
      """
      with current_app.app_context():
          result = db.execute(text(fetch_query_string('select_query_where_name.sql')), **kw).fetchall()
          if result:
              kw['query_id'] = result[0]['id']
          else:
              result = db.execute(text(fetch_query_string('insert_query.sql')), **kw)
              kw['query_id'] = result.lastrowid
              if (not kw['query_id']):
                  result = result.fetchall()
                  kw['query_id']  = result[0]['id']
          db.execute(text(fetch_query_string('insert_query_node.sql')), **kw)