-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mysql会话管理相关函数迁移到engine #1661
mysql会话管理相关函数迁移到engine #1661
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1661 +/- ##
==========================================
+ Coverage 75.71% 76.24% +0.53%
==========================================
Files 91 91
Lines 14212 14298 +86
==========================================
+ Hits 10760 10901 +141
+ Misses 3452 3397 -55
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rds的判断也放到mysql engine内是不是可以,调用完全忽略db类型判断
但这样会照成engine耦合太高 |
同意 @weideguo 的说法, 目前的版本应该不错的 |
有个想法 from sql.engines.mysql import MysqlEngine
class AliyunRDS(MysqlEngine):
# 将sql/aliyun_rds.py的函数迁移值此
def processlist(self, instance_name, command_type):
pass
def get_engine(instance=None):
"""获取数据库操作engine"""
if instance.db_type == "mysql":
if AliyunRdsConfig.objects.filter(instance=instance, is_enable=True).exists():
from .cloud.aliyun_rds import AliyunRDS
return AliyunRDS(instance=instance)
else:
from .mysql import MysqlEngine
return MysqlEngine(instance=instance) 但我没有阿里云的环境,不敢直接拆 |
俺也没有环境了,不过这样改挺好,可以单独开pr,这个就这样子就行 |
可以另提pr等人验证,😄 |
进行一些函数迁移以及增加一些相关测试,没有涉及功能改动。
关联之前的pr #1563