parent
20dd368264
commit
3943058d84
@ -0,0 +1,25 @@
|
||||
from Util.MySQLUtil import init_mysql_pool
|
||||
|
||||
|
||||
async def main():
|
||||
mysql_pool = await init_mysql_pool()
|
||||
async with mysql_pool.acquire() as conn:
|
||||
await conn.ping()
|
||||
async with conn.cursor() as cur:
|
||||
# 查询获取所有知识点
|
||||
await cur.execute("""
|
||||
SELECT id,
|
||||
title,
|
||||
parent_id,
|
||||
is_leaf
|
||||
FROM knowledge_points
|
||||
ORDER BY parent_id, id
|
||||
""")
|
||||
rows = await cur.fetchall()
|
||||
print(rows)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import asyncio
|
||||
|
||||
asyncio.run(main())
|
Loading…
Reference in new issue