-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
47 lines (37 loc) · 927 Bytes
/
test.py
File metadata and controls
47 lines (37 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test
"""
__author__ = "trydying"
import asyncio
import www.orm as orm
from www.models import User, Comment
from www.config import configs
loop = asyncio.get_event_loop()
async def mycreatpool(**kw):
await orm.create_pool(
loop=loop,
user=kw["user"],
password=kw["password"],
db=kw["db"],
port=kw["port"],
host=kw["host"],
)
async def test():
# 数据库参数
# await orm.create_pool(loop=loop, user="wide", password="wide123456789", db="test")
params = configs.db
await mycreatpool(
# user=params.user,
# password=params.password,
# db=params.db,
# port=params.port,
# host=params.host,
**params,
)
# 传入事件循环
await orm.create_pool(loop=loop)
loop.run_until_complete(test())
# u = User(name="trydying")
# u.update()