style: 移除性能优化版描述,简化模块注释
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
数据库连接与操作模块 - 性能优化版
|
数据库连接与操作模块
|
||||||
"""
|
"""
|
||||||
import pymysql
|
import pymysql
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
@@ -9,7 +9,7 @@ from app.config import AppConfig
|
|||||||
|
|
||||||
|
|
||||||
class DatabaseManager:
|
class DatabaseManager:
|
||||||
"""数据库管理器 - 高性能版"""
|
"""数据库管理器"""
|
||||||
|
|
||||||
def __init__(self, config: AppConfig):
|
def __init__(self, config: AppConfig):
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
数据处理核心模块 - 性能优化版
|
数据处理核心模块
|
||||||
"""
|
"""
|
||||||
import chardet
|
import chardet
|
||||||
import os
|
import os
|
||||||
@@ -78,7 +78,7 @@ class ProcessLogger:
|
|||||||
|
|
||||||
|
|
||||||
class DataProcessor:
|
class DataProcessor:
|
||||||
"""数据处理器 - 高性能版"""
|
"""数据处理器"""
|
||||||
|
|
||||||
# 批量插入大小(根据实际测试,5000 是比较好的平衡点)
|
# 批量插入大小(根据实际测试,5000 是比较好的平衡点)
|
||||||
BATCH_SIZE = 5000
|
BATCH_SIZE = 5000
|
||||||
@@ -414,7 +414,7 @@ class DataProcessor:
|
|||||||
def _process_csv_file_fast(self, csv_file: Path, table_name: str,
|
def _process_csv_file_fast(self, csv_file: Path, table_name: str,
|
||||||
conn=None, table_created: bool = False) -> Tuple[int, bool]:
|
conn=None, table_created: bool = False) -> Tuple[int, bool]:
|
||||||
"""
|
"""
|
||||||
高性能处理单个 CSV 文件
|
处理单个 CSV 文件
|
||||||
使用 LOAD DATA LOCAL INFILE,比 executemany 快 10-50 倍
|
使用 LOAD DATA LOCAL INFILE,比 executemany 快 10-50 倍
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -776,7 +776,7 @@ class DataProcessor:
|
|||||||
return data_dirs
|
return data_dirs
|
||||||
|
|
||||||
def _process_csv_files(self):
|
def _process_csv_files(self):
|
||||||
"""处理所有 CSV 文件(高性能版 - 使用 LOAD DATA INFILE + 连接复用)"""
|
"""处理所有 CSV 文件(使用 LOAD DATA INFILE + 连接复用)"""
|
||||||
self.logger.info("正在处理 CSV 文件并上传到数据库...")
|
self.logger.info("正在处理 CSV 文件并上传到数据库...")
|
||||||
|
|
||||||
# 查找数据目录
|
# 查找数据目录
|
||||||
|
|||||||
Reference in New Issue
Block a user