SQL Backend
dagster_authkit.auth.backends.sql
Unified SQL Backend via Peewee - v1.0 Production-Ready Implements identity management with support for SQLite, PostgreSQL, and MySQL.
UserTable
Bases: Model
Internal Peewee model for user persistence. Mapped to 'users' table.
PeeweeAuthBackend
Bases: AuthBackend
Peewee-based auth backend supporting SQLite, PostgreSQL, and MySQL. Automatically detects and handles legacy _meta.database for backward compat.
__init__
__init__(config)
Initialise database connection, create tables, run migrations, bootstrap admin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Dict with keys |
required |
Raises:
| Type | Description |
|---|---|
DatabaseError
|
If the database connection fails. |
RuntimeError
|
If the |
authenticate
authenticate(username, password)
Validates credentials and returns a universal AuthUser.
get_user
get_user(username)
Fetches user metadata without password verification.
add_user
add_user(username, password, role, email='', full_name='', performed_by='system', **kwargs)
Creates a new user and logs the event to stdout.
delete_user
delete_user(username, performed_by='system')
Deactivates user (soft delete) and bumps session version to revoke all sessions.
change_password
change_password(username, new_password, performed_by='system')
Updates password hash and bumps session version to revoke all sessions.
list_users
list_users()
Lists all active users in the system.
change_role
change_role(username, new_role, performed_by='system')
Updates user role and bumps session version to propagate the change.
get_session_version
staticmethod
get_session_version(username)
Get the current session_version for a user. Returns 1 if user not found.