Postgres Plugin¶
-
class
sirbot.plugins.postgres.
PgPlugin
(*, sql_migration_directory=None, version=None, **kwargs)[source]¶ Handle database connection and sql migration for postgresql.
Database migration to new version are automatically handled at startup when the
version
andsql_migration_directory
argument are passed.The
sql_migration_directory
should be a directory with a single sql file per version andversion
should follow semantic versioning.Parameters: - version – Current version of the bot.
- sql_migration_directory – Directory where migration sql files are located.
- **kwargs – Arguments for
asyncpg.pool.create_pool()
.
- Variables:
- pool: Instance of
asyncpg.pool.Pool
.
- pool: Instance of
-
async-with
connection
()[source]¶ Acquire a connection from the pool
Returns: Instance of asyncpg.connection.Connection