docs: def operate_menu():
      "Select between these operations on the database"
  
      selection = True
      while selection:
  
          print globals()['operate_menu'].__doc__
          selection = select([
              'chill.database functions',
              'execute sql file',
              'render_node',
              'New collection',
              'Manage collection',
              'Add document for node',
              'help',
              ])
          if selection == 'chill.database functions':
              mode_database_functions()
          elif selection == 'execute sql file':
              print "View the sql file and show a fill in the blanks interface with raw_input"
              sqlfile = choose_query_file()
              if not sqlfile:
                  # return to the menu choices if not file picked
                  selection = True
              else:
                  sql_named_placeholders_re = re.compile(r":(\w+)")
                  sql = fetch_query_string(sqlfile)
                  placeholders = set(sql_named_placeholders_re.findall(sql))
                  print sql
                  data = {}
                  for placeholder in placeholders:
                      value = raw_input(placeholder + ': ')
                      data[placeholder] = value
  
                  result = []
                  try:
                      result = db.execute(text(sql), data)
                  except DatabaseError as err:
                      current_app.logger.error("DatabaseError: %s", err)
  
                  if result and result.returns_rows:
                      result = result.fetchall()
                      print result
                      if not result:
                          print 'No results.'
                      else:
                          kw = result[0]
  
                          if 'node_id' in kw:
                              print 'render node %s' % kw['node_id']
                              value = render_node(kw['node_id'], **kw)
                              print safe_dump(value, default_flow_style=False)
                          else:
                              #print safe_dump(rowify(result, [(x, None) for x in result[0].keys()]), default_flow_style=False)
                              print safe_dump([dict(zip(x.keys(), x.values())) for x in result], default_flow_style=False)
  
          elif selection == 'render_node':
              print globals()['render_node'].__doc__
              node_id = existing_node_input()
  
              value = render_value_for_node(node_id)
              print safe_dump(value, default_flow_style=False)
  
          elif selection == 'New collection':
              mode_new_collection()
          elif selection == 'Manage collection':
              mode_collection()
          elif selection == 'Add document for node':
              folder = current_app.config.get('DOCUMENT_FOLDER')
              if not folder:
                  print "No DOCUMENT_FOLDER configured for the application."
              else:
                  choices = map(os.path.basename,
                              glob(os.path.join(folder, '*'))
                              )
                  choices.sort()
                  if len(choices) == 0:
                      print "No files found in DOCUMENT_FOLDER."
                  else:
                      filename = select(choices)
                      if filename:
                          defaultname = os.path.splitext(filename)[0]
                          nodename = raw_input("Enter name for node [{0}]: ".format(defaultname)) or defaultname
                          node = insert_node(name=nodename, value=filename)
                          print "Added document '%s' to node '%s' with id: %s" % (filename, nodename, node)
          elif selection == 'help':
              print "------"
              print __doc__
              print "------"
          else:
              print 'Done'