Skip to content

Database schema

PyWacli persists everything through SQLAlchemy. SQLite is the default (WAL mode, foreign keys on), with PostgreSQL and MySQL also supported — see Configuration → database.

Tables

Table Contents
messages Text messages with sender metadata
message_edits Edit history for messages
statuses WhatsApp status / story updates
reactions Emoji reactions
media Media metadata (type, filename, path, sender)
media_handshake Per-entry sync status (success / failure reason)
conversations Unified conversation log

How it's used

  • messages powers the dashboard feed, contact list, and the conversation history loaded by AI Automate.
  • media + media_handshake back the media viewer: metadata in one, upload outcome in the other.
  • conversations is the unified per-chat log derived from the conversation.new event.

Choosing a backend

Zero setup, single file, great for one machine. Defaults to ~/.pywacli/pywacli.db when no path is configured. Runs with PRAGMA journal_mode=WAL and PRAGMA foreign_keys=ON.

Use for multi-user or server deployments. Connection is built as postgresql://user:password@host:port/name. Inserts use RETURNING to fetch new row ids.

Connection is built as mysql+pymysql://user:password@host:port/name.

Connection pooling

The engine is created with pool_pre_ping=True, so stale connections are detected and refreshed automatically — handy for long-running connect sessions against a remote database.