You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
772 B

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())