260706_2_로그인 인증 검토

This commit is contained in:
2026-07-07 20:40:10 +09:00
parent f8633bb1fe
commit 5da0260be3
29 changed files with 720 additions and 336 deletions
+31
View File
@@ -0,0 +1,31 @@
import asyncio
import sys
import aiomysql
from dotenv import load_dotenv
load_dotenv(".env")
from config.config_db import init_db_pool, close_db_pool
async def main():
await init_db_pool()
from config.config_db import get_db_pool
pool = get_db_pool()
async with pool.acquire() as connection, connection.cursor(aiomysql.DictCursor) as cursor:
try:
await cursor.execute("SELECT * FROM users")
users = await cursor.fetchall()
print("Users count:", len(users))
for u in users:
print(u)
await cursor.execute("SELECT * FROM companies")
companies = await cursor.fetchall()
print("Companies count:", len(companies))
for c in companies:
print(c)
except Exception as e:
print("Error:", e)
await close_db_pool()
if __name__ == "__main__":
asyncio.run(main())