From 66c7d33e0aedc6c736ac491a27cf351cebaf0390 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 4 Apr 2023 10:34:22 +0800 Subject: [PATCH] bugfix --- sqlor/dbpools.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sqlor/dbpools.py b/sqlor/dbpools.py index 295e792..f4cd7d4 100755 --- a/sqlor/dbpools.py +++ b/sqlor/dbpools.py @@ -234,18 +234,22 @@ class DBPools: driver = myImport(dbdesc['driver']) conn = None cur = None + desc = dbdesc['kwargs'].copy() + pw = desc.get('password') + if pw: + desc['password'] = unpassword(pw) if self.isAsyncDriver(dbname): if dbdesc['driver'] == 'sqlite3': - conn = await driver.connect(dbdesc['kwargs']['dbname']) + conn = await driver.connect(desc['dbname']) else: - conn = await driver.connect(**dbdesc['kwargs']) + conn = await driver.connect(**desc) cur = await conn.cursor() return True,conn,cur else: if dbdesc['driver'] == 'sqlite3': - conn = driver.connect(dbdesc['kwargs']['dbname']) + conn = driver.connect(desc['dbname']) else: - conn = driver.connect(**dbdesc['kwargs']) + conn = driver.connect(**desc) cur = conn.cursor() return False,conn,cur