Attention
This is the documentation for HARP Proxy, actually published as an early preview. Both the software and documentation are a work in progress, and although we already use it on various production servers, they may contain inaccuracies, typographical errors, huge mistakes and empty pages. We work hard to eradicate all mistakes and implement stuff, but it is a long and tedious process. We appreciate your patience and understanding. Of course, any help will be greatly appreciated.
SQLAlchemy Storage¶
The harp.contrib.sqlalchemy_storage application implements database storage using SQLAlchemy with asynchronous engines. The test suites runs against SQLite, PostgreSQL and MySQL, using various implementations. Other drivers may work too, but are not tested.
External documentation:
Configuration¶
SQLite¶
SQLite has the benefit of requiring no external service, and is thus the default storage engine. Do not use it in production, as it is slow and have concurrency issues.
storage:
type: sqlalchemy
url: sqlite+aiosqlite:///harp.db
PostgreSQL¶
PostgreSQL is the recommended storage engine for production use.
storage:
type: sqlalchemy
url: postgresql+asyncpg://user:password@localhost:5432/harp
MySQL¶
MySQL / MariaDB is another option for production use.
Using aiomysql:
storage:
type: sqlalchemy
url: mysql+aiomysql://user:password@localhost:3306/harp
Using asyncmy:
storage:
type: sqlalchemy
url: mysql+asyncmy://user:password@localhost:3306/harp
Common options¶
Drop tables¶
To drop and recreate all tables, use --reset
. It will attempt to drop all tables before running the migrations.
harp start ... --reset
Logging¶
To instruct SQLAlchemy to log all queries, set LOGGING_SQLALCHEMY=INFO
in your env.
LOGGING_SQLALCHEMY=INFO harp start ...