Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Fix task can't decode to utf8 error
Browse files Browse the repository at this point in the history
  • Loading branch information
a76yyyy committed Aug 31, 2022
1 parent e72329a commit a027deb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion db/db_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,19 @@ async def ConvertNewType(self, db=DB(), path=config.sqlite3.path):
try:
import aiosqlite
from sqlalchemy import update
from db import User
from db import User, Task
conn = await aiosqlite.connect(f"{config.sqlite3.path}")
conn.text_factory = bytes
cursor = await conn.execute('SELECT id, password, userkey FROM user')
for row in await cursor.fetchall():
result = await self.db._update(update(User).where(User.id == row[0]).values(password=row[1],userkey=row[2]))
await cursor.close()

cursor = await conn.execute('SELECT id, init_env, env, session FROM task')
for row in await cursor.fetchall():
result = await self.db._update(update(Task).where(Task.id == row[0]).values(init_env=row[1],env=row[2],session=row[3]))
await cursor.close()
await conn.close()
except Exception as e:
raise e

Expand Down

0 comments on commit a027deb

Please sign in to comment.