Skip to main content
Ayase Quart supports three database types: MySQL, PostgreSQL, and SQLite. The database stores archived posts, threads, and media metadata.

Database type selection

Set the database type in the [db] section:
db_type
string
default:"mysql"
required
Database type to useOptions:
  • mysql
  • postgresql
  • sqlite
echo
boolean
default:"false"
Print rendered SQL statements to console for debugging

MySQL configuration

Configure MySQL connection settings in the [db.mysql] section. These follow pymysql/aiomysql connection keys.
[db]
db_type = 'mysql'
echo = false

[db.mysql]
host = '127.0.0.1'
port = 3306
db = 'asagi'
user = 'asagi'
password = 'asagi'
minsize = 1
maxsize = 50

MySQL parameters

host
string
default:"127.0.0.1"
MySQL server hostname or IP address
port
integer
default:"3306"
MySQL server port
unix_socket
string
Path to MySQL Unix socket. Use this instead of host/port for local connections.Example: /var/run/mysqld/mysqld.sock
db
string
default:"asagi"
required
Database name
user
string
default:"asagi"
required
Database username
password
string
default:"asagi"
required
Database password
minsize
integer
default:"1"
Minimum number of connections in the connection pool
maxsize
integer
default:"50"
Maximum number of connections in the connection pool
A connection pool is created per database per process for optimal performance.

PostgreSQL configuration

Configure PostgreSQL connection settings in the [db.postgresql] section. These follow aiosqlite connection keys.
[db]
db_type = 'postgresql'
echo = false

[db.postgresql]
host = 'localhost'
port = 5432
user = 'asagi'
password = 'asagi'
database = 'asagi'
min_size = 1
max_size = 50

PostgreSQL parameters

host
string
default:"localhost"
PostgreSQL server hostname or IP address. Also used for Unix domain socket connections.
port
integer
default:"5432"
PostgreSQL server port
user
string
default:"asagi"
required
Database username
password
string
default:"asagi"
required
Database password
database
string
default:"asagi"
required
Database name
min_size
integer
default:"1"
Minimum number of connections in the connection pool
max_size
integer
default:"50"
Maximum number of connections in the connection pool

SQLite configuration

Configure SQLite database file path in the [db.sqlite] section. These follow aiosqlite connection keys.
[db]
db_type = 'sqlite'
echo = false

[db.sqlite]
database = 'path/to/file.db'

SQLite parameters

database
string
default:"path/to/file.db"
required
Path to the SQLite database file. Can be relative or absolute.
SQLite is suitable for smaller archives or development environments. For production deployments with multiple boards and high traffic, MySQL or PostgreSQL is recommended.

Database schema

Ayase Quart expects database tables to follow the Asagi schema format. Each board has its own table with the board’s shortname.
The validate_boards_db option in the [app] section controls whether Ayase Quart validates that all boards defined in boards.toml have corresponding database tables at startup.
[app]
validate_boards_db = true
Set to false to skip validation if you’re adding board configurations before their data is available.

Connection pooling

Ayase Quart creates a connection pool per database per process. The pool size is controlled by:
  • MySQL: minsize and maxsize
  • PostgreSQL: min_size and max_size
  • SQLite: No pooling configuration needed
  • minsize/min_size: 1
  • maxsize/max_size: 10
  • minsize/min_size: 5
  • maxsize/max_size: 50
  • minsize/min_size: 10
  • maxsize/max_size: 100
Ensure your database server’s max_connections setting can accommodate all connection pools across all application processes.

Troubleshooting

  • Verify the database server is running
  • Check host and port are correct
  • Ensure firewall rules allow connections
  • For MySQL, try using unix_socket for local connections
  • Verify username and password are correct
  • Check database user has appropriate permissions
  • Ensure user can connect from the application’s host
  • Reduce maxsize/max_size in connection pool settings
  • Increase database server’s max_connections
  • Check for connection leaks in application logs
  • Verify board tables exist in the database
  • Check table names match board shortnames exactly
  • Ensure validate_boards_db is set appropriately

Build docs developers (and LLMs) love