@@ -302,25 +302,10 @@ async def set_authorizer(
302302 Set an authorizer callback to control database access.
303303
304304 The authorizer callback is invoked for each SQL statement that is prepared,
305- and controls whether specific operations are permitted. The callback function
306- receives five string arguments:
305+ and controls whether specific operations are permitted.
307306
308- Args:
309- authorizer_callback: A callable that receives:
310- - action_code (int): The action to be authorized (e.g., SQLITE_READ)
311- - arg1 (str): First argument, meaning depends on action_code
312- - arg2 (str): Second argument, meaning depends on action_code
313- - db_name (str): Database name (e.g., "main", "temp")
314- - trigger_name (str): Name of trigger or view that is doing the access, or None
315-
316- The callback should return:
317- - SQLITE_OK (0): Allow the operation
318- - SQLITE_DENY (1): Deny the operation, raise sqlite3.DatabaseError
319- - SQLITE_IGNORE (2): Treat operation as no-op
320-
321- Pass None to remove the authorizer.
307+ Example::
322308
323- Example:
324309 import sqlite3
325310
326311 async def restrict_drops(action_code, arg1, arg2, db_name, trigger_name):
@@ -331,6 +316,25 @@ async def restrict_drops(action_code, arg1, arg2, db_name, trigger_name):
331316 return sqlite3.SQLITE_OK
332317
333318 await conn.set_authorizer(restrict_drops)
319+
320+ See ``sqlite3`` documentation for details:
321+ https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.set_authorizer
322+
323+ :param authorizer_callback: An optional callable that receives five arguments:
324+
325+ - ``action_code`` (int): The action to be authorized (e.g., ``SQLITE_READ``)
326+ - ``arg1`` (str): First argument, meaning depends on ``action_code``
327+ - ``arg2`` (str): Second argument, meaning depends on ``action_code``
328+ - ``db_name`` (str): Database name (e.g., ``"main"``, ``"temp"``)
329+ - ``trigger_name`` (str): Name of trigger or view that is doing the access, or ``None``
330+
331+ The callback should return:
332+
333+ - ``SQLITE_OK`` (0): Allow the operation
334+ - ``SQLITE_DENY`` (1): Deny the operation, raise ``sqlite3.DatabaseError``
335+ - ``SQLITE_IGNORE`` (2): Treat operation as no-op
336+
337+ Pass ``None`` to remove the authorizer.
334338 """
335339 await self ._execute (self ._conn .set_authorizer , authorizer_callback )
336340
0 commit comments