1 Star 0 Fork 0

Nidhogg14/sql_work

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
equipment_add.py 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
tuchuantao 提交于 2022-04-06 14:28 . 模块解耦
from Merge import *
jifang()
start = input('请输入起始机房:=')
end = input('请输入目标机房:=')
end_region = None
start_region = None
def cloud():
global end, end_region, start, start_region
if (start and end) in all_list:
start_region = all_dict['{}'.format(start)]
end_region = all_dict['{}'.format(end)]
else:
print('起始机房or目标机房填写有误,请重新填写!')
def equipment_add():
add1 = f"update province_city_region set region_add='{end_region}', region_shift='{end_region}';" # 忽略报错
add2 = f"update region_config set to_count='5000000' where region='{end_region}';"
add3 = f"update region_config set to_count='0' where region='{start_region}';"
find1 = "select region_add,region_shift from province_city_region;"
find2 = "select region,to_count from region_config;"
sql1 = 'ssh bj-china-db-coredata'
sql2 = 'mysql core_data'
print('\n' + '-----------------执行命令-------------------')
print(sql1+'\n'+sql2)
print(add1+'\n'+add2+'\n'+add3)
print('\n' + '-----------------查看语句-------------------')
print(find1+'\n'+find2)
if __name__ == '__main__':
cloud()
if end_region is None or start_region is None:
print('end_region or start_region parameter is none!')
else:
equipment_add()
# 设置新增设备上线的默认机房 core_data数据库
# update province_city_region set region_add='hz10-acloud', region_shift='hz10-acloud';
# update region_config set to_count='5000000' where region='hz10-acloud';
# update region_config set to_count='0' where region='sh-acloud';
# 查看语句
# select region_add,region_shift from province_city_region;
# select region,to_count from region_config;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/Nidhogg14/sql_work.git
[email protected]:Nidhogg14/sql_work.git
Nidhogg14
sql_work
sql_work
master

搜索帮助