`PyriteDB` maintains two separate connections to the same SQLite database:
Problems:
Options: 1. Use SQLAlchemy `text()` for all raw SQL, keeping one connection/session 2. Wrap raw connection in a helper that participates in the same transaction 3. Provide a `db.execute_raw(sql, params)` method so plugins don't touch `_raw_conn`
Also: metadata stored as JSON strings in DB loses type safety and makes querying metadata fields expensive. Consider SQLite generated columns or a separate metadata table for commonly queried fields.