style: format all Python files with Black
Apply Black formatter to the entire codebase for consistent code style. Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
@@ -40,13 +40,13 @@ class MySQLConnection(BaseDatabaseConnection):
|
||||
|
||||
try:
|
||||
self.connection = mysql.connector.connect(
|
||||
host=self.config.get('host', 'localhost'),
|
||||
port=self.config.get('port', 3306),
|
||||
database=self.config['database'],
|
||||
user=self.config['username'],
|
||||
password=self.config['password'],
|
||||
charset=self.config.get('charset', 'utf8mb4'),
|
||||
autocommit=False
|
||||
host=self.config.get("host", "localhost"),
|
||||
port=self.config.get("port", 3306),
|
||||
database=self.config["database"],
|
||||
user=self.config["username"],
|
||||
password=self.config["password"],
|
||||
charset=self.config.get("charset", "utf8mb4"),
|
||||
autocommit=False,
|
||||
)
|
||||
print(
|
||||
f"成功连接到 MySQL 数据库: {self.config.get('host', 'localhost')}"
|
||||
@@ -153,7 +153,7 @@ class MySQLConnection(BaseDatabaseConnection):
|
||||
Returns:
|
||||
str: SQL query with MySQL-compatible placeholders
|
||||
"""
|
||||
return sql.replace('?', '%s')
|
||||
return sql.replace("?", "%s")
|
||||
|
||||
def _convert_table_names(self, sql: str) -> str:
|
||||
"""
|
||||
@@ -171,10 +171,10 @@ class MySQLConnection(BaseDatabaseConnection):
|
||||
import re
|
||||
|
||||
# Convert [dbo].[TableName] to dbo_TableName
|
||||
sql = re.sub(r'\[dbo\]\.\[([^\]]+)\]', r'dbo_\1', sql)
|
||||
sql = re.sub(r"\[dbo\]\.\[([^\]]+)\]", r"dbo_\1", sql)
|
||||
|
||||
# Remove square brackets from column names (e.g., [Column] -> Column)
|
||||
sql = re.sub(r'\[([^\]]+)\]', r'\1', sql)
|
||||
sql = re.sub(r"\[([^\]]+)\]", r"\1", sql)
|
||||
|
||||
return sql
|
||||
|
||||
|
||||
Reference in New Issue
Block a user