input: 
  from flask import Flask, jsonify
  import sqlite3
  
  def fetch_data(database_path: str) -> dict:
      """ Fetches data from an SQL database and returns it as a JSON object.
      >>> fetch_data('database.db')
      {"id": 1, "name": "John Doe", "email": "john.doe@example.com"}
      >>> fetch_data('empty_database.db')
      {}
      """
      app = Flask(__name__)
      
      def dict_factory(cursor, row):
          d = {}
          for idx, col in enumerate(cursor.description):
              d[col[0]] = row[idx]
          return d
      
      @app.route('/', methods=['GET'])
      def index():
          connection = sqlite3.connect(database_path)
          connection.row_factory = dict_factory
          cur = connection.cursor()
          all_data = cur.execute('SELECT * FROM users;').fetchall()
          return jsonify(all_data)
      
      return index()
  
output:     with app.test_request_context('/'):
          response = index()
          return response.get_json()