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
versionandsql_migration_directoryargument are passed.The
sql_migration_directoryshould be a directory with a single sql file per version andversionshould 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