ci: make ci happy lint the code, delete unused imports

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong0618
2023-05-24 18:42:55 +08:00
parent 562d5a98cc
commit b098a48898
75 changed files with 1110 additions and 824 deletions

View File

@@ -3,27 +3,27 @@
import pymysql
class MySQLOperator:
"""Connect MySQL Database fetch MetaData For LLM Prompt
Args:
Usage:
class MySQLOperator:
"""Connect MySQL Database fetch MetaData For LLM Prompt
Args:
Usage:
"""
default_db = ["information_schema", "performance_schema", "sys", "mysql"]
def __init__(self, user, password, host="localhost", port=3306) -> None:
self.conn = pymysql.connect(
host=host,
user=user,
port=port,
passwd=password,
charset="utf8mb4",
cursorclass=pymysql.cursors.DictCursor
cursorclass=pymysql.cursors.DictCursor,
)
def get_schema(self, schema_name):
with self.conn.cursor() as cursor:
_sql = f"""
select concat(table_name, "(" , group_concat(column_name), ")") as schema_info from information_schema.COLUMNS where table_schema="{schema_name}" group by TABLE_NAME;
@@ -31,7 +31,7 @@ class MySQLOperator:
cursor.execute(_sql)
results = cursor.fetchall()
return results
def get_index(self, schema_name):
pass
@@ -43,10 +43,10 @@ class MySQLOperator:
cursor.execute(_sql)
results = cursor.fetchall()
dbs = [d["Database"] for d in results if d["Database"] not in self.default_db]
dbs = [
d["Database"] for d in results if d["Database"] not in self.default_db
]
return dbs
def get_meta(self, schema_name):
pass