1.创建临时表
create table temp_0808_tb_XXX like tb_XXX;
CREATE TABLE xxx.xxx as select * from xxx.xxx where 1=2;
2.临时表插入迁移数据
insert into temp_0808_XXX SELECT * FROM `tb_XXX` WHERE create_time < DATE_ADD(CURDATE(),INTERVAL -30 DAY);
3.删除迁移了的数据(删除之前请查看一下临时表数据是否成功插入)
DELETE FROM `tb_XXX` WHERE create_time < DATE_ADD(CURDATE(),INTERVAL -30 DAY);
TRUNCATE table tb_xxxx;
4.使用python替换大文本关键字
https://www.jb51.net/python/285747v65.html
input_file = r'E:\xxx'
output_file = r'E:\xxx'
with open(input_file, 'r') as f_input, open(output_file, 'w') as f_output:
for line in f_input:
new_line = line.replace('keyword1', 'keyword2')
f_output.write(new_line)
5.使用命令窗口执行SQL,但是大文件命令窗口读取失败报错“Error reading file”
使用工具->导入表导入