prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Implement `tables.delete` RPC method
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mathesar/rpc/tables.py`
  Content:
  ```
  1 from typing import Optional, TypedDict
  2 
  3 from modernrpc.core import rpc_method, REQUEST_KEY
  4 from modernrpc.auth.basic import http_basic_auth_login_required
  5 
  6 from db.tables.operations.select import get_table_info
  7 from mathesar.rpc.exceptions.handlers import handle_rpc_exceptions
  8 from mathesar.rpc.utils import connect
  9 
  10 
  11 class TableInfo(TypedDict):
  12     """
  13     Information about a table.
  14 
  15     Attributes:
  16         oid: The `oid` of the table in the schema.
  17         name: The name of the table.
  18         schema: The `oid` of the schema where the table lives.
  19         description: The description of the table.
  20     """
  21     oid: int
  22     name: str
  23     schema: int
  24     description: Optional[str]
  25 
  26 
  27 @rpc_method(name="tables.list")
  28 @http_basic_auth_login_required
  29 @handle_rpc_exceptions
  30 def list_(*, schema_oid: int, database_id: int, **kwargs) -> list[TableInfo]:
  31     """
  32     List information about tables for a schema. Exposed as `list`.
  33 
  34     Args:
  35         schema_oid: Identity of the schema in the user's database.
  36         database_id: The Django id of the database containing the table.
  37 
  38     Returns:
  39         A list of table details.
  40     """
  41     user = kwargs.get(REQUEST_KEY).user
  42     with connect(database_id, user) as conn:
  43         raw_table_info = get_table_info(schema_oid, conn)
  44     return [
  45         TableInfo(tab) for tab in raw_table_info
  46     ]
  47
  ```
  
  Path: `db/tables/operations/drop.py`
  Content:
  ```
  1 from db.connection import execute_msar_func_with_engine
  2 
  3 
  4 def drop_table(name, schema, engine, cascade=False, if_exists=False):
  5     execute_msar_func_with_engine(engine, 'drop_table', schema, name, cascade, if_exists)
  6
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/db/tables/operations/drop.py b/db/tables/operations/drop.py
  --- a/db/tables/operations/drop.py
  +++ b/db/tables/operations/drop.py
  @@ -1,5 +1,21 @@
  -from db.connection import execute_msar_func_with_engine
  +from db.connection import execute_msar_func_with_engine, exec_msar_func
   
   
   def drop_table(name, schema, engine, cascade=False, if_exists=False):
       execute_msar_func_with_engine(engine, 'drop_table', schema, name, cascade, if_exists)
  +
  +
  +def drop_table_from_database(table_oid, conn, cascade=False):
  +    """
  +    Drop a table.
  +
  +    Args:
  +        table_oid: OID of the table to drop.
  +        cascade: Whether to drop the dependent objects.
  +
  +    Returns:
  +        Returns the fully qualified name of the dropped table.
  +    """
  +    return exec_msar_func(
  +        conn, 'drop_table', table_oid, cascade
  +    ).fetchone()[0]
  diff --git a/mathesar/rpc/tables.py b/mathesar/rpc/tables.py
  --- a/mathesar/rpc/tables.py
  +++ b/mathesar/rpc/tables.py
  @@ -4,6 +4,7 @@
   from modernrpc.auth.basic import http_basic_auth_login_required
   
   from db.tables.operations.select import get_table_info
  +from db.tables.operations.drop import drop_table_from_database
   from mathesar.rpc.exceptions.handlers import handle_rpc_exceptions
   from mathesar.rpc.utils import connect
   
  @@ -44,3 +45,25 @@
       return [
           TableInfo(tab) for tab in raw_table_info
       ]
  +
  +
  +@rpc_method(name="tables.delete")
  +@http_basic_auth_login_required
  +@handle_rpc_exceptions
  +def delete(
  +    *, table_oid: int, database_id: int, cascade: bool = False, **kwargs
  +) -> str:
  +    """
  +    Delete a table from a schema.
  +
  +    Args:
  +        table_oid: Identity of the table in the user's database.
  +        database_id: The Django id of the database containing the table.
  +        cascade: Whether to drop the dependent objects.
  +
  +    Returns:
  +        The name of the dropped table.
  +    """
  +    user = kwargs.get(REQUEST_KEY).user
  +    with connect(database_id, user) as conn:
  +        return drop_table_from_database(table_oid, conn, cascade)
  
verification_info: {"golden_diff": "diff --git a/db/tables/operations/drop.py b/db/tables/operations/drop.py\n--- a/db/tables/operations/drop.py\n+++ b/db/tables/operations/drop.py\n@@ -1,5 +1,21 @@\n-from db.connection import execute_msar_func_with_engine\n+from db.connection import execute_msar_func_with_engine, exec_msar_func\n \n \n def drop_table(name, schema, engine, cascade=False, if_exists=False):\n     execute_msar_func_with_engine(engine, 'drop_table', schema, name, cascade, if_exists)\n+\n+\n+def drop_table_from_database(table_oid, conn, cascade=False):\n+    \"\"\"\n+    Drop a table.\n+\n+    Args:\n+        table_oid: OID of the table to drop.\n+        cascade: Whether to drop the dependent objects.\n+\n+    Returns:\n+        Returns the fully qualified name of the dropped table.\n+    \"\"\"\n+    return exec_msar_func(\n+        conn, 'drop_table', table_oid, cascade\n+    ).fetchone()[0]\ndiff --git a/mathesar/rpc/tables.py b/mathesar/rpc/tables.py\n--- a/mathesar/rpc/tables.py\n+++ b/mathesar/rpc/tables.py\n@@ -4,6 +4,7 @@\n from modernrpc.auth.basic import http_basic_auth_login_required\n \n from db.tables.operations.select import get_table_info\n+from db.tables.operations.drop import drop_table_from_database\n from mathesar.rpc.exceptions.handlers import handle_rpc_exceptions\n from mathesar.rpc.utils import connect\n \n@@ -44,3 +45,25 @@\n     return [\n         TableInfo(tab) for tab in raw_table_info\n     ]\n+\n+\n+@rpc_method(name=\"tables.delete\")\n+@http_basic_auth_login_required\n+@handle_rpc_exceptions\n+def delete(\n+    *, table_oid: int, database_id: int, cascade: bool = False, **kwargs\n+) -> str:\n+    \"\"\"\n+    Delete a table from a schema.\n+\n+    Args:\n+        table_oid: Identity of the table in the user's database.\n+        database_id: The Django id of the database containing the table.\n+        cascade: Whether to drop the dependent objects.\n+\n+    Returns:\n+        The name of the dropped table.\n+    \"\"\"\n+    user = kwargs.get(REQUEST_KEY).user\n+    with connect(database_id, user) as conn:\n+        return drop_table_from_database(table_oid, conn, cascade)\n", "issue": "Implement `tables.delete` RPC method\n\n", "before_files": [{"content": "from typing import Optional, TypedDict\n\nfrom modernrpc.core import rpc_method, REQUEST_KEY\nfrom modernrpc.auth.basic import http_basic_auth_login_required\n\nfrom db.tables.operations.select import get_table_info\nfrom mathesar.rpc.exceptions.handlers import handle_rpc_exceptions\nfrom mathesar.rpc.utils import connect\n\n\nclass TableInfo(TypedDict):\n    \"\"\"\n    Information about a table.\n\n    Attributes:\n        oid: The `oid` of the table in the schema.\n        name: The name of the table.\n        schema: The `oid` of the schema where the table lives.\n        description: The description of the table.\n    \"\"\"\n    oid: int\n    name: str\n    schema: int\n    description: Optional[str]\n\n\n@rpc_method(name=\"tables.list\")\n@http_basic_auth_login_required\n@handle_rpc_exceptions\ndef list_(*, schema_oid: int, database_id: int, **kwargs) -> list[TableInfo]:\n    \"\"\"\n    List information about tables for a schema. Exposed as `list`.\n\n    Args:\n        schema_oid: Identity of the schema in the user's database.\n        database_id: The Django id of the database containing the table.\n\n    Returns:\n        A list of table details.\n    \"\"\"\n    user = kwargs.get(REQUEST_KEY).user\n    with connect(database_id, user) as conn:\n        raw_table_info = get_table_info(schema_oid, conn)\n    return [\n        TableInfo(tab) for tab in raw_table_info\n    ]\n", "path": "mathesar/rpc/tables.py"}, {"content": "from db.connection import execute_msar_func_with_engine\n\n\ndef drop_table(name, schema, engine, cascade=False, if_exists=False):\n    execute_msar_func_with_engine(engine, 'drop_table', schema, name, cascade, if_exists)\n", "path": "db/tables/operations/drop.py"}], "after_files": [{"content": "from typing import Optional, TypedDict\n\nfrom modernrpc.core import rpc_method, REQUEST_KEY\nfrom modernrpc.auth.basic import http_basic_auth_login_required\n\nfrom db.tables.operations.select import get_table_info\nfrom db.tables.operations.drop import drop_table_from_database\nfrom mathesar.rpc.exceptions.handlers import handle_rpc_exceptions\nfrom mathesar.rpc.utils import connect\n\n\nclass TableInfo(TypedDict):\n    \"\"\"\n    Information about a table.\n\n    Attributes:\n        oid: The `oid` of the table in the schema.\n        name: The name of the table.\n        schema: The `oid` of the schema where the table lives.\n        description: The description of the table.\n    \"\"\"\n    oid: int\n    name: str\n    schema: int\n    description: Optional[str]\n\n\n@rpc_method(name=\"tables.list\")\n@http_basic_auth_login_required\n@handle_rpc_exceptions\ndef list_(*, schema_oid: int, database_id: int, **kwargs) -> list[TableInfo]:\n    \"\"\"\n    List information about tables for a schema. Exposed as `list`.\n\n    Args:\n        schema_oid: Identity of the schema in the user's database.\n        database_id: The Django id of the database containing the table.\n\n    Returns:\n        A list of table details.\n    \"\"\"\n    user = kwargs.get(REQUEST_KEY).user\n    with connect(database_id, user) as conn:\n        raw_table_info = get_table_info(schema_oid, conn)\n    return [\n        TableInfo(tab) for tab in raw_table_info\n    ]\n\n\n@rpc_method(name=\"tables.delete\")\n@http_basic_auth_login_required\n@handle_rpc_exceptions\ndef delete(\n    *, table_oid: int, database_id: int, cascade: bool = False, **kwargs\n) -> str:\n    \"\"\"\n    Delete a table from a schema.\n\n    Args:\n        table_oid: Identity of the table in the user's database.\n        database_id: The Django id of the database containing the table.\n        cascade: Whether to drop the dependent objects.\n\n    Returns:\n        The name of the dropped table.\n    \"\"\"\n    user = kwargs.get(REQUEST_KEY).user\n    with connect(database_id, user) as conn:\n        return drop_table_from_database(table_oid, conn, cascade)\n", "path": "mathesar/rpc/tables.py"}, {"content": "from db.connection import execute_msar_func_with_engine, exec_msar_func\n\n\ndef drop_table(name, schema, engine, cascade=False, if_exists=False):\n    execute_msar_func_with_engine(engine, 'drop_table', schema, name, cascade, if_exists)\n\n\ndef drop_table_from_database(table_oid, conn, cascade=False):\n    \"\"\"\n    Drop a table.\n\n    Args:\n        table_oid: OID of the table to drop.\n        cascade: Whether to drop the dependent objects.\n\n    Returns:\n        Returns the fully qualified name of the dropped table.\n    \"\"\"\n    return exec_msar_func(\n        conn, 'drop_table', table_oid, cascade\n    ).fetchone()[0]\n", "path": "db/tables/operations/drop.py"}]}