Skip to content

Commit a2b401d

Browse files
committed
use correct argument for asyncmysql
1 parent d3a39e7 commit a2b401d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Diff for: defog/async_admin_methods.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,10 @@ async def create_empty_tables(self, dev: bool = False):
338338

339339
elif self.db_type == "mysql":
340340
import aiomysql
341-
342-
conn = await aiomysql.connect(**self.db_creds)
341+
db_creds = self.db_creds.copy()
342+
db_creds["db"] = db_creds["database"]
343+
del db_creds["database"]
344+
conn = await aiomysql.connect(**db_creds)
343345
async with conn.cursor() as cur:
344346
for statement in ddl.split(";"):
345347
await cur.execute(statement)

Diff for: defog/async_generate_schema.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ async def generate_mysql_schema(
243243
except:
244244
raise Exception("aiomysql not installed.")
245245

246-
conn = await aiomysql.connect(**self.db_creds)
246+
db_creds = self.db_creds.copy()
247+
db_creds["db"] = db_creds["database"]
248+
del db_creds["database"]
249+
conn = await aiomysql.connect(**db_creds)
247250
cur = await conn.cursor()
248251
schemas = {}
249252

Diff for: defog/query.py

+3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ async def async_execute_query_once(db_type: str, db_creds, query: str):
206206
import aiomysql
207207
except:
208208
raise Exception("aiomysql not installed.")
209+
db_creds = self.db_creds.copy()
210+
db_creds["db"] = db_creds["database"]
211+
del db_creds["database"]
209212
conn = await aiomysql.connect(**db_creds)
210213
cur = await conn.cursor()
211214
await cur.execute(query)

0 commit comments

Comments
 (0)