Skip to content

Conversation

alec
Copy link

@alec alec commented Aug 13, 2025

https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.set_authorizer

Example:

import sqlite3

async def restrict_drops(action_code, arg1, arg2, db_name, trigger_name):
    # Deny all DROP operations
    if action_code == sqlite3.SQLITE_DROP_TABLE:
        return sqlite3.SQLITE_DENY
    # Allow everything else
    return sqlite3.SQLITE_OK

await conn.set_authorizer(restrict_drops)
Perf Test Iterations Duration Rate
inserts 11939 2.0s 5968.8/s
inserts_authorized 11841 2.0s 5919.7/s

https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.set_authorizer

Example:
    import sqlite3

    async def restrict_drops(action_code, arg1, arg2, db_name, trigger_name):
        # Deny all DROP operations
        if action_code == sqlite3.SQLITE_DROP_TABLE:
            return sqlite3.SQLITE_DENY
        # Allow everything else
        return sqlite3.SQLITE_OK

    await conn.set_authorizer(restrict_drops)

Perf Test                 Iterations  Duration         Rate
inserts                        11939      2.0s     5968.8/s
inserts_authorized             11841      2.0s     5919.7/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant