07 2024 档案
摘要:定义一个统一的schema类对提交的业务参数进行格式和数据约束非常有必要, 下面使用 pydantic 来封装此工具; import logging from pydantic import BaseModel, ValidationError, root_validator class Pydan
阅读全文
摘要:一、基础环境说明 节点名 节点ip 角色 操作系统 node1 10.42.8.13 control-plane,etcd,master CentOS7.9 node2 10.42.8.14 control-plane,etcd,master CentOS7.9 node3 10.42.8.15 c
阅读全文
摘要:基础数据 LONGITUDE_LATITUDE = { "110000": {"name": "北京市", "latitude": 39.904989, "longitude": 116.405285}, "110101": {"name": "东城区", "latitude": 39.917544
阅读全文
摘要:flask 迁移数据库时可能会遇到找不到版本的问题 export FLASK_APP=run.py flask db migrate 执行上述命令时正常会提示加了哪些字段,删除了哪些字段 但是有时候会提示: ERROR [flask_migrate] Error: Can't locate revi
阅读全文
摘要:参考文档:https://rook.github.io/docs/rook/v1.12/Getting-Started/quickstart/#prerequisites 1、下载部署文件 git clone --single-branch --branch v1.12.4 https://gith
阅读全文
摘要:背景: 有个一个组织机构. 并没有设计父级id, 只有id, title, nature 三个字段, nature=1/2/3/4 分别表示级几级单位; 现在要模糊查询本级, 上级, 上上级, 上上上级的title中包含 特定字符的记录;使用sqlalchemy递归查询,下面代码没调试,不保证运行,
阅读全文
摘要:工具类cvs util.py #!/usr/bin/env python # -*- coding: utf-8 -*- import csv import codecs import io class UTF8Recoder: """ Iterator that reads an encoded
阅读全文