input: Write a function that creates a Flask API to fetch data from an SQL database and present the data in JSON format. The function should initialize the API, define a route to fetch data from the "users" table, and return the fetched data in JSON format.
  assert index() == {'data': [{'id': 1, 'name': 'John'}, {'id': 2, 'name': 'Jane'}]}
  assert index() == {'data': []}
  assert index() == {'data': [{'id': 3, 'name': 'Alice'}]}
  assert index() == {'data': [{'id': 4, 'name': 'Bob'}, {'id': 5, 'name': 'Charlie'}]}
  assert index() == {'data': [{'id': 6, 'name': 'David'}]}
output: 
  from flask import Flask, jsonify
  import sqlite3
  
  app = Flask(__name__)
  
  @app.route('/users', methods=['GET'])
  def index():
      conn = sqlite3.connect('database.db')
      cursor = conn.cursor()
      cursor.execute("SELECT id, name FROM users")
      rows = cursor.fetchall()
      conn.close()
      data = [{'id': row[0], 'name': row[1]} for row in rows]
      return jsonify({'data': data})
  