https://developer.aliyun.com/article/723909
Month: December 2020
airflow 文件立即生效
dockerfile
https://blog.csdn.net/taiyangdao/article/details/73214449
在Dockerfile中,只能有一个ENTRYPOINT指令,如果有多个ENTRYPOINT指令则以最后一个为准。
在Dockerfile中,只能有一个CMD指令,如果有多个CMD指令则以最后一个为准。
在Dockerfile中,ENTRYPOINT指令或CMD指令,至少必有其一。
es查询语句
https://www.cnblogs.com/zys-blog/p/13207196.html
import requests
import json
query = {
“size”:1,
“sort”:[{“table_id9.date2″:”desc”}],
“query”:{“match”:{“app_name”:”xiaoshouleihetong”}}
}
query2 = {
“size”:1,
“sort”:[{“table_id9.date2″:”desc”}],
“query”:{“range”:{“process.created_at”:{“gte”:”2020-01-01″,”lte”:”now”,”format”:”yyyy-MM-dd”}},”match”:{“app_name”:”xiaoshouleihetong”}}
}
query = {
“size”:1,
“sort”:[{“table_id9.date2″:”desc”}],
“query”:{“bool”:{“must”:[{“match”:{“app_name”:”xiaoshouleihetong”}},
{“terms”: {“process.status”:[“start”,”finish”]}},
{“range”:{“table_id9.date2”:{“from”:”2020-10-01″}}}]}}
}
query2 ={
“query”:{“match”:{“_id”:”xiaoshouleihetong_387490″}}
}
query2={“size”:0,”query”:{“bool”:{“must”:[{“terms”:{“process.status”:[“start”,”finish”]}}],”must”:[{“bool”:{“should”:[{“term”:{“process.monitor_handlers”:”w”}} ]}},{“term”:{“app_name”:”xiaoshouleihetong”}}]}},”aggs”:{“nestedAggs”:{“nested”:{“path”:”table_id9″},”aggs”:{“groupby”:{“date_histogram”:{“interval”:”quarter”,”min_doc_count”:”1″,”script”:”if(doc[‘table_id9.date2’].isEmpty()){return 0}else{return doc[‘table_id9.date2’]}”},”aggs”:{“aggsfield”:{“sum”:{“field”:”table_id9.double1″}}}}}}}}
pymongo
https://segmentfault.com/a/1190000019167801 常用操作
https://www.cnblogs.com/zhuawang/p/3965272.html 常用操作
https://www.imooc.com/wenda/detail/587590 sum操作
https://www.runoob.com/mongodb/mongodb-aggregate.html 手册
https://www.cnblogs.com/bigben0123/p/9753327.html 数组内操作
操作符
$lt 小于
$lte 小于等于
$gt 大于
$gte 大于等于
$ne 不等于
$in in 检查目标属性值是条件表达式中的一员
$nin not in
$set set(用于 update 语句)
$unset 与 $set 相反,表示移除文档属性。
$inc += (用于 update 语句)
$exists exists (判断是否存在,仅有 True 和 False 两个值)
$all 属性值包含全部条件元素,注意和 $in 的区别
$size 匹配数组属性元素的数量
$type 判断属性类型
$regex 正则表达式查询
$elemMatch 子属性里的查询
$push 向数组属性添加元素
$pushAll 向数组属性添加元素
$addToSet 和 $push 类似,不过仅在该元素不存在时才添加 (Set 表示不重复元素集合)
$each 添加多个元素用
$pop 移除数组属性的元素(按数组下标移除)
$pull 按值移除
$pullAll 移除所有符合提交的元素
$where 用 JS 代码来代替有些丑陋的 $lt、$gt
import datetime
start = datetime.datetime(2020,10,1,0,0,0)
rbd = clientc.find({“app_id”:”XiaoShouLeiHeTong”,’status’:{‘$in’:[‘start’,’finish’]},’XiaoShouLeiHeTongPin_slave_YiShouKuan’:{‘$elemMatch’:{“ShouKuanShiJian”:{‘$gte’:start}}}},{“_id”:0,”instance_id”:1,’XiaoShouLeiHeTongPin_FaQiShiJian’:1})
r = list(rbd)
len(r)
import datetime
start = datetime.datetime(2020,10,1,0,0,0)
rbd = clientc.aggregate([{“$unwind”:”$XiaoShouLeiHeTongPin_slave_YiShouKuan”},
{‘$match’:{“XiaoShouLeiHeTongPin_slave_YiShouKuan.ShouKuanShiJian”:{‘$gte’:start},”app_id”:”XiaoShouLeiHeTong”,’status’:{‘$in’:[‘start’,’finish’]}}},
{“$project”:{“_id”:0,”instance_id”:1}}])
r = list(rbd)
len(r)