摘要: 定义一个统一的schema类对提交的业务参数进行格式和数据约束非常有必要, 下面使用 pydantic 来封装此工具; import logging from pydantic import BaseModel, ValidationError, root_validator class Pydan 阅读全文
posted @ 2024-07-31 16:17 干炸小黄鱼 阅读(408) 评论(0) 推荐(0)
摘要: 一、基础环境说明 节点名 节点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 阅读全文
posted @ 2024-07-29 11:32 干炸小黄鱼 阅读(3165) 评论(0) 推荐(0)
摘要: 基础数据 LONGITUDE_LATITUDE = { "110000": {"name": "北京市", "latitude": 39.904989, "longitude": 116.405285}, "110101": {"name": "东城区", "latitude": 39.917544 阅读全文
posted @ 2024-07-26 16:46 干炸小黄鱼 阅读(429) 评论(0) 推荐(0)
摘要: flask 迁移数据库时可能会遇到找不到版本的问题 export FLASK_APP=run.py flask db migrate 执行上述命令时正常会提示加了哪些字段,删除了哪些字段 但是有时候会提示: ERROR [flask_migrate] Error: Can't locate revi 阅读全文
posted @ 2024-07-25 14:23 干炸小黄鱼 阅读(621) 评论(0) 推荐(0)
摘要: 参考文档:https://rook.github.io/docs/rook/v1.12/Getting-Started/quickstart/#prerequisites 1、下载部署文件 git clone --single-branch --branch v1.12.4 https://gith 阅读全文
posted @ 2024-07-19 11:43 干炸小黄鱼 阅读(51) 评论(0) 推荐(0)
摘要: 背景: 有个一个组织机构. 并没有设计父级id, 只有id, title, nature 三个字段, nature=1/2/3/4 分别表示级几级单位; 现在要模糊查询本级, 上级, 上上级, 上上上级的title中包含 特定字符的记录;使用sqlalchemy递归查询,下面代码没调试,不保证运行, 阅读全文
posted @ 2024-07-15 10:05 干炸小黄鱼 阅读(139) 评论(0) 推荐(0)
摘要: 工具类cvs util.py #!/usr/bin/env python # -*- coding: utf-8 -*- import csv import codecs import io class UTF8Recoder: """ Iterator that reads an encoded 阅读全文
posted @ 2024-07-11 09:16 干炸小黄鱼 阅读(77) 评论(0) 推荐(0)
摘要: 需求; 统计不同组织下的成绩风险等级类型个数; attacker_group = ( db.session.query(ReportResult, Report, Organization) .join(Report, Report.id == ReportResult.report_id) .jo 阅读全文
posted @ 2024-06-28 15:49 干炸小黄鱼 阅读(205) 评论(0) 推荐(0)
摘要: 常用匹配规则 . 除换行符以外的所有字符。 ^ 字符串开头。 $ 字符串结尾。 \d,\w,\s 匹配数字、字符、空格。 \D,\W,\S 匹配非数字、非字符、非空格。 [abc] 匹配 a、b 或 c 中的一个字母。 [a-z] 匹配 a 到 z 中的一个字母。 [^abc] 匹配除了 a、b 或 阅读全文
posted @ 2024-06-03 10:24 干炸小黄鱼 阅读(73) 评论(0) 推荐(0)
摘要: # 使用 Go 基础镜像作为构建阶段 FROM golang:1.18 AS build # 设置工作目录 WORKDIR /app # 复制项目文件到工作目录 COPY . . # 下载依赖包 RUN go mod download # 编译项目 RUN go build -o main . # 阅读全文
posted @ 2024-05-27 19:26 干炸小黄鱼 阅读(112) 评论(0) 推荐(0)