编辑
2024-07-05
数据相关
00
请注意,本文编写于 292 天前,最后修改于 292 天前,其中某些信息可能已经过时。

目录

执行处理数据时,报错:

执行处理数据时,报错:

js
ERROR 1292 (22007) at line 4: Incorrect datetime value: '' for column 'end_time' at row 3

经过,排查发现从原始数据抓取后的数据,发生了变化,需要进行修改处理。

js
#处理国家球队数据 sed -n "1p" ${qt_odds_file}|awk -F "[$][$]" '{print $1}'|uniq > ${qt_odds_split}/.c1_${dt_time}.txt sed -i "s/\!/\n/g" ${qt_odds_split}/.c1_${dt_time}.txt cat ${qt_odds_split}/.c1_${dt_time}.txt cut -d "^" -f1,2,3,4,5,6,7 ${qt_odds_split}/.c1_${dt_time}.txt|uniq > ${qt_odds_split}/c1_${dt_time}.txt cat ${qt_odds_split}/c1_${dt_time}.txt #处理具体详细数据 awk -F "[$][$]" '{print $2}' ${qt_odds_file} > ${qt_odds_split}/.c2_${dt_time}.txt sed -i "s/\!/\n/g" ${qt_odds_split}/.c2_${dt_time}.txt cat ${qt_odds_split}/.c2_${dt_time}.txt echo "" sed -i "/^$/d" ${qt_odds_split}/.c2_${dt_time}.txt cut -d "^" -f1,2,3,4,5,6,7,8,9,10,11 ${qt_odds_split}/.c2_${dt_time}.txt > ${qt_odds_split}/c2_${dt_time}.txt cat ${qt_odds_split}/c2_${dt_time}.txt #cat ${qt_odds_split}/.c2_${dt_time}.txt > ${qt_odds_split}/c2_${dt_time}.txt

另外,需要修改数据库的sql_mode:

js
root@localhost : 16:25:41>show variables like '%sql_mode%'; +---------------+----------------------------------------------------------------------------------------------------+ | Variable_name | Value | +---------------+----------------------------------------------------------------------------------------------------+ | sql_mode | STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION | +---------------+----------------------------------------------------------------------------------------------------+ 1 row in set (0.01 sec) root@localhost : 16:35:16>set global sql_mode=NO_ENGINE_SUBSTITUTION; Query OK, 0 rows affected (0.00 sec)

再次,运行程序,一切正常。

本文作者:Kevin@灼华

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!