mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 20:51:25 +03:00
chore(chart): Switched to a new library to work with postgres. From psycopg2 to asynpg
This commit is contained in:
parent
9750900d3e
commit
110effaeb2
1 changed files with 17 additions and 0 deletions
17
chart/database/server.py
Normal file
17
chart/database/server.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import asyncpg
|
||||
import yaml
|
||||
|
||||
config = yaml.safe_load(open("config.yaml", "r"))
|
||||
|
||||
async def create_pool() -> asyncpg.pool.Pool:
|
||||
pool = await asyncpg.create_pool(
|
||||
user=config['database']['user'],
|
||||
password=config['database']['password'],
|
||||
database=config['database']['name'],
|
||||
host=config['database']['host'],
|
||||
port=config['database']['port'],
|
||||
min_size=5,
|
||||
max_size=20
|
||||
)
|
||||
|
||||
return pool
|
Loading…
Add table
Reference in a new issue