【02】把 Elasticsearch 当数据库使:过滤和排序

使用 https://github.com/taowen/es-monitor 可以用 SQL 进行 elasticsearch 的查询。本章介绍简单的文档过滤条件

exchange='nyse'

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol where exchange='nyse' limit 1
EOF
{"sector": "n/a", "_type": "symbol", "market_cap": 4469064, "name": "3D Systems Corporation", "exchange": "nyse", "symbol": "DDD", "last_sale": 807, "_index": "symbol", "ipo_year": null, "_id": "AVLqbUjEQ3iIyyVFLQgV", "industry": "Technology"}

Elasticsearch

{"query": {"term": {"exchange": "nyse"}}, "size": 1
}
{"hits": {"hits": [{"_score": 1.728313, "_type": "symbol", "_id": "AVLqbUjEQ3iIyyVFLQgV", "_source": {"sector": "n/a", "market_cap": 4469064, "name": "3D Systems Corporation", "exchange": "nyse", "symbol": "DDD", "last_sale": 807, "ipo_year": null, "industry": "Technology"}, "_index": "symbol"}], "total": 3240, "max_score": 1.728313}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 6, "timed_out": false
}

Profile

[{"query": [{"query_type": "TermQuery","lucene": "exchange:nyse","time": "2.336230000ms","breakdown": {"score": 470159,"create_weight": 417360,"next_doc": 786055,"match": 0,"build_scorer": 662656,"advance": 0}}],"rewrite_time": 3566,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "1.561495000ms"}]}
]

exchange='nyse' AND sector='Technology'

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol where exchange='nyse' and sector='Technology' limit 1
EOF
{"sector": "Technology", "_type": "symbol", "market_cap": 4469064, "name": "3D Systems Corporation", "exchange": "nyse", "symbol": "DDD", "last_sale": 807, "_index": "symbol", "ipo_year": null, "_id": "AVLqdtWhQ3iIyyVFLSJQ", "industry": "Computer Software: Prepackaged Software"}

Elasticsearch

{"query": {"bool": {"filter": [{"term": {"exchange": "nyse"}}, {"term": {"sector": "Technology"}}]}}, "size": 1
}
{"hits": {"hits": [{"_score": 0.0, "_type": "symbol", "_id": "AVLqdtWhQ3iIyyVFLSJQ", "_source": {"sector": "Technology", "market_cap": 4469064, "name": "3D Systems Corporation", "exchange": "nyse", "symbol": "DDD", "last_sale": 807, "ipo_year": null, "industry": "Computer Software: Prepackaged Software"}, "_index": "symbol"}], "total": 186, "max_score": 0.0}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 5, "timed_out": false
}

Profile

[{"query": [{"query_type": "BooleanQuery","lucene": "#exchange:nyse #sector:Technology","time": "3.999703000ms","breakdown": {"score": 54437,"create_weight": 413531,"next_doc": 1213355,"match": 0,"build_scorer": 736504,"advance": 0},"children": [{"query_type": "TermQuery","lucene": "exchange:nyse","time": "1.175638000ms","breakdown": {"score": 0,"create_weight": 186745,"next_doc": 0,"match": 0,"build_scorer": 616840,"advance": 372053}},{"query_type": "TermQuery","lucene": "sector:Technology","time": "0.4062380000ms","breakdown": {"score": 0,"create_weight": 125321,"next_doc": 115632,"match": 0,"build_scorer": 45136,"advance": 120149}}]}],"rewrite_time": 23008,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "0.1031780000ms"}]}
]

last_sale > 985

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol where last_sale > 985 limit 1
EOF
{"sector": "Finance", "_type": "symbol", "market_cap": 42010000, "name": "1347 Capital Corp.", "exchange": "nasdaq", "symbol": "TFSCU", "last_sale": 1005, "_index": "symbol", "ipo_year": 2014, "_id": "AVLqdtWdQ3iIyyVFLRZB", "industry": "Business Services"}

Elasticsearch

{"query": {"range": {"last_sale": {"gt": 985.0}}}, "size": 1
}
{"hits": {"hits": [{"_score": 1.0, "_type": "symbol", "_id": "AVLqdtWdQ3iIyyVFLRZB", "_source": {"sector": "Finance", "market_cap": 42010000, "name": "1347 Capital Corp.", "exchange": "nasdaq", "symbol": "TFSCU", "last_sale": 1005, "ipo_year": 2014, "industry": "Business Services"}, "_index": "symbol"}], "total": 4285, "max_score": 1.0}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 2, "timed_out": false
}

Profile

[{"query": [{"query_type": "MultiTermQueryConstantScoreWrapper","lucene": "last_sale:{985 TO *]","time": "4.684710000ms","breakdown": {"score": 423966,"create_weight": 21384,"next_doc": 469032,"match": 0,"build_scorer": 3770328,"advance": 0}}],"rewrite_time": 10493,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "1.261998000ms"}]}
]

last_sale != 985

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol where last_sale != 985 limit 1
EOF
{"sector": "Finance", "_type": "symbol", "market_cap": null, "name": "1347 Capital Corp.", "exchange": "nasdaq", "symbol": "TFSCR", "last_sale": 16, "_index": "symbol", "ipo_year": 2014, "_id": "AVLqdtWdQ3iIyyVFLRZA", "industry": "Business Services"}

Elasticsearch

{"query": {"bool": {"must_not": {"term": {"last_sale": 985}}}}, "size": 1
}
{"hits": {"hits": [{"_score": 1.0, "_type": "symbol", "_id": "AVLqdtWdQ3iIyyVFLRZA", "_source": {"sector": "Finance", "market_cap": null, "name": "1347 Capital Corp.", "exchange": "nasdaq", "symbol": "TFSCR", "last_sale": 16, "ipo_year": 2014, "industry": "Business Services"}, "_index": "symbol"}], "total": 6708, "max_score": 1.0}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 1, "timed_out": false
}

Profile

[{"query": [{"query_type": "BooleanQuery","lucene": "+*:* -last_sale: Y","time": "14.10871500ms","breakdown": {"score": 3397824,"create_weight": 401619,"next_doc": 7993655,"match": 0,"build_scorer": 141022,"advance": 0},"children": [{"query_type": "MatchAllDocsQuery","lucene": "*:*","time": "1.694079000ms","breakdown": {"score": 974401,"create_weight": 5175,"next_doc": 705676,"match": 0,"build_scorer": 8827,"advance": 0}},{"query_type": "TermQuery","lucene": "last_sale: Y","time": "0.4805160000ms","breakdown": {"score": 0,"create_weight": 342905,"next_doc": 0,"match": 0,"build_scorer": 104919,"advance": 32692}}]}],"rewrite_time": 32619,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "4.604778000ms"}]}
]

exchange='nyse' AND NOT sector='Technology'

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol where exchange='nyse' AND NOT sector='Technology' limit 1
EOF
{"sector": "Health Care", "_type": "symbol", "market_cap": 3865437245, "name": "3M Company", "exchange": "nyse", "symbol": "MMM", "last_sale": 15244, "_index": "symbol", "ipo_year": null, "_id": "AVLqdtWhQ3iIyyVFLSJR", "industry": "Medical/Dental Instruments"}

Elasticsearch

{"query": {"bool": {"filter": [{"term": {"exchange": "nyse"}}], "must_not": [{"term": {"sector": "Technology"}}]}}, "size": 1
}
{"hits": {"hits": [{"_score": 0.0, "_type": "symbol", "_id": "AVLqdtWhQ3iIyyVFLSJR", "_source": {"sector": "Health Care", "market_cap": 3865437245, "name": "3M Company", "exchange": "nyse", "symbol": "MMM", "last_sale": 15244, "ipo_year": null, "industry": "Medical/Dental Instruments"}, "_index": "symbol"}], "total": 3054, "max_score": 0.0}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 5, "timed_out": false
}

Profile

[{"query": [{"query_type": "BooleanQuery","lucene": "#exchange:nyse -sector:Technology","time": "3.078346000ms","breakdown": {"score": 164364,"create_weight": 216094,"next_doc": 1872817,"match": 0,"build_scorer": 114716,"advance": 0},"children": [{"query_type": "TermQuery","lucene": "exchange:nyse","time": "0.4679310000ms","breakdown": {"score": 0,"create_weight": 119897,"next_doc": 290703,"match": 0,"build_scorer": 57331,"advance": 0}},{"query_type": "TermQuery","lucene": "sector:Technology","time": "0.2424240000ms","breakdown": {"score": 0,"create_weight": 62239,"next_doc": 0,"match": 0,"build_scorer": 32978,"advance": 147207}}]}],"rewrite_time": 19262,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "0.5360760000ms"}]}
]

exchange='nyse' OR NOT sector='Technology'

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol where exchange='nyse' OR NOT sector='Technology' limit 1
EOF
{"sector": "Health Care", "_type": "symbol", "market_cap": 3865437245, "name": "3M Company", "exchange": "nyse", "symbol": "MMM", "last_sale": 15244, "_index": "symbol", "ipo_year": null, "_id": "AVLqdtWhQ3iIyyVFLSJR", "industry": "Medical/Dental Instruments"}

Elasticsearch

{"query": {"bool": {"should": [{"term": {"exchange": "nyse"}}, {"bool": {"must_not": [{"term": {"sector": "Technology"}}]}}]}}, "size": 1
}
{"hits": {"hits": [{"_score": 0.99838185, "_type": "symbol", "_id": "AVLqdtWhQ3iIyyVFLSJR", "_source": {"sector": "Health Care", "market_cap": 3865437245, "name": "3M Company", "exchange": "nyse", "symbol": "MMM", "last_sale": 15244, "ipo_year": null, "industry": "Medical/Dental Instruments"}, "_index": "symbol"}], "total": 6245, "max_score": 0.99838185}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 9, "timed_out": false
}

Profile

[{"query": [{"query_type": "BooleanQuery","lucene": "exchange:nyse (-sector:Technology +*:*)","time": "21.24846700ms","breakdown": {"score": 4197895,"create_weight": 815882,"next_doc": 5963510,"match": 0,"build_scorer": 3902610,"advance": 0},"children": [{"query_type": "TermQuery","lucene": "exchange:nyse","time": "1.099460000ms","breakdown": {"score": 219612,"create_weight": 529960,"next_doc": 266196,"match": 0,"build_scorer": 83692,"advance": 0}},{"query_type": "BooleanQuery","lucene": "-sector:Technology +*:*","time": "5.269110000ms","breakdown": {"score": 1221522,"create_weight": 209290,"next_doc": 1693148,"match": 0,"build_scorer": 521166,"advance": 0},"children": [{"query_type": "TermQuery","lucene": "sector:Technology","time": "0.6576720000ms","breakdown": {"score": 0,"create_weight": 141704,"next_doc": 0,"match": 0,"build_scorer": 274371,"advance": 241597}},{"query_type": "MatchAllDocsQuery","lucene": "*:*","time": "0.9663120000ms","breakdown": {"score": 441766,"create_weight": 5317,"next_doc": 508525,"match": 0,"build_scorer": 10704,"advance": 0}}]}]}],"rewrite_time": 61389,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "4.847758000ms"}]}
]

date > now() - INTERVAL '60 DAYS'

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from quote where "date" > now() - interval '30 DAYS' limit 1
EOF

这个 now() 和 interval 的语法是和postgresql一致的(http://www.postgresql.org/docs/9.1/static/functions-datetime.html)

{"volume": 118900, "_type": "quote", "_index": "quote", "symbol": "AMRS", "adj_close": 147, "high": 149, "low": 138, "date": "2016-02-16", "close": 147, "_id": "AMRS-2016-02-16", "open": 140}

Elasticsearch

{"query": {"range": {"date": {"gt": 1453212988000}}}, "size": 1
}

查询是和普通的大于一样的。

symbol LIKE 'AAP%'

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol WHERE symbol LIKE 'AAP%'
EOF
{"sector": "Technology", "_type": "symbol", "market_cap": 522690000000, "name": "Apple Inc.", "exchange": "nasdaq", "symbol": "AAPL", "last_sale": 9427, "_index": "symbol", "ipo_year": 1980, "_id": "AVL0FqFJog4u0JP7lzka", "industry": "Computer Manufacturing"}
{"sector": "Finance", "_type": "symbol", "market_cap": 105960000, "name": "Atlantic Alliance Partnership Corp.", "exchange": "nasdaq", "symbol": "AAPC", "last_sale": 1019, "_index": "symbol", "ipo_year": 2015, "_id": "AVL0FqFJog4u0JP7lzlf", "industry": "Business Services"}
{"sector": "Consumer Services", "_type": "symbol", "market_cap": 148395246, "name": "Advance Auto Parts Inc", "exchange": "nyse", "symbol": "AAP", "last_sale": 13857, "_index": "symbol", "ipo_year": null, "_id": "AVL0FqFQog4u0JP7l0R7", "industry": "Other Specialty Stores"}

Elasticsearch

{"query": {"wildcard": {"symbol": "AAP*"}}
}
{"hits": {"hits": [{"_score": 1.0, "_type": "symbol", "_id": "AVL0FqFJog4u0JP7lzka", "_source": {"sector": "Technology", "market_cap": 522690000000, "name": "Apple Inc.", "exchange": "nasdaq", "symbol": "AAPL", "last_sale": 9427, "ipo_year": 1980, "industry": "Computer Manufacturing"}, "_index": "symbol"}, {"_score": 1.0, "_type": "symbol", "_id": "AVL0FqFJog4u0JP7lzlf", "_source": {"sector": "Finance", "market_cap": 105960000, "name": "Atlantic Alliance Partnership Corp.", "exchange": "nasdaq", "symbol": "AAPC", "last_sale": 1019, "ipo_year": 2015, "industry": "Business Services"}, "_index": "symbol"}, {"_score": 1.0, "_type": "symbol", "_id": "AVL0FqFQog4u0JP7l0R7", "_source": {"sector": "Consumer Services", "market_cap": 148395246, "name": "Advance Auto Parts Inc", "exchange": "nyse", "symbol": "AAP", "last_sale": 13857, "ipo_year": null, "industry": "Other Specialty Stores"}, "_index": "symbol"}], "total": 3, "max_score": 1.0}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 29, "timed_out": false
}

Profile

[{"query": [{"query_type": "MultiTermQueryConstantScoreWrapper","lucene": "symbol:AAP*","time": "5.018644000ms","breakdown": {"score": 3186,"create_weight": 34308,"next_doc": 31760,"match": 0,"build_scorer": 4949390,"advance": 0}},{"query_type": "BooleanQuery","lucene": "symbol:AAP symbol:AAPC symbol:AAPL","time": "4.731495000ms","breakdown": {"score": 0,"create_weight": 205709,"next_doc": 26459,"match": 0,"build_scorer": 4299185,"advance": 0},"children": [{"query_type": "TermQuery","lucene": "symbol:AAP","time": "0.09350600000ms","breakdown": {"score": 0,"create_weight": 15337,"next_doc": 4021,"match": 0,"build_scorer": 74148,"advance": 0}},{"query_type": "TermQuery","lucene": "symbol:AAPC","time": "0.07045600000ms","breakdown": {"score": 0,"create_weight": 6874,"next_doc": 1225,"match": 0,"build_scorer": 62357,"advance": 0}},{"query_type": "TermQuery","lucene": "symbol:AAPL","time": "0.03618000000ms","breakdown": {"score": 0,"create_weight": 4934,"next_doc": 1253,"match": 0,"build_scorer": 29993,"advance": 0}}]}],"rewrite_time": 25703,"collector": [{"name": "SimpleTopScoreDocCollector","reason": "search_top_hits","time": "0.04072600000ms"}]}
]}
]

从profile结果可以看出,所谓的LIKE查询,其实不是一个个去查文档。而是先从字典表里把这个字段的所有的符合LIKE条件的term查出来,然后去查满足这些term的文档。把LIKE变成一堆=条件的OR来处理的。

ORDER BY name

SQL

$ cat << EOF | ./es_query.py http://127.0.0.1:9200
select * from symbol order by name limit 1
EOF
{"sector": "n/a", "_type": "symbol", "market_cap": 72460000, "name": "iShares 0-5 Year Investment Grade Corporate Bond ETF", "exchange": "nasdaq", "symbol": "SLQD", "last_sale": 4997, "_index": "symbol", "ipo_year": null, "_id": "AVLqdtWfQ3iIyyVFLRwf", "industry": "n/a"}

Elasticsearch

{"sort": [{"name": "asc"}], "size": 1
}
{"hits": {"hits": [{"sort": ["0"], "_type": "symbol", "_source": {"sector": "n/a", "market_cap": 72460000, "name": "iShares 0-5 Year Investment Grade Corporate Bond ETF", "exchange": "nasdaq", "symbol": "SLQD", "last_sale": 4997, "ipo_year": null, "industry": "n/a"}, "_score": null, "_index": "symbol", "_id": "AVLqdtWfQ3iIyyVFLRwf"}], "total": 6714, "max_score": null}, "_shards": {"successful": 1, "failed": 0, "total": 1}, "took": 4, "timed_out": false
}

Profile

[{"query": [{"query_type": "MatchAllDocsQuery","lucene": "*:*","time": "1.379354000ms","breakdown": {"score": 0,"create_weight": 32506,"next_doc": 850386,"match": 0,"build_scorer": 496462,"advance": 0}}],"rewrite_time": 18167,"collector": [{"name": "SimpleFieldCollector","reason": "search_top_hits","time": "1.225077000ms"}]}
]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/261985.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

登录页面跳出框架的JS

框架页面下跳转到登录页面&#xff0c;会遇到登录页面仍然在框架中 <script type"text/javascript">if (top.location ! self.location) {top.locationself.location;}</script> 这个js就能解决问题了&#xff01;转载于:https://www.cnblogs.com/longxi…

python dialect='excel'是什么意思_python读取和生成excel文件

今天来看一下如何使用python处理excel文件&#xff0c;处理excel文件是在工作中经常用到的&#xff0c;python为我们考虑到了这一点&#xff0c;python中本身就自带csv模块... 今天来看一下如何使用python处理excel文件&#xff0c;处理excel文件是在工作中经常用到的&#xff…

linux运维工程师 知乎,运维面试一般问些什么问题 知乎

面试基本上都离不开以下这些问题&#xff1a;1.请用最简洁的语言描述您从前的工作经历和工作成果。2.您认为此工作岗位应当具备哪些素质&#xff1f;3.您平时习惯于单独工作还是团队工作&#xff1f;4.您对原来的单位和上司的看法如何&#xff1f;5.您如何描述自己的个性&#…

[ javascript ] 司徒正美的fadeOut-fadeIn效果!

首先感谢司徒正美的文章! 在司徒大神的博客看到一个简单的渐入渐出的效果。全然採用js实现。 例如以下&#xff1a; <!doctype html> <html dir"ltr" lang"zh-CN" ><head><meta charset"utf-8"/><meta http-equiv&qu…

玩转博客园的5个小技巧

转载自:http://www.cnblogs.com/lloydsheng/archive/2010/05/17/1737267.html 写博客也有几年了&#xff0c;现在能找到的第一篇博文发布时间是2007年11月11日&#xff0c;那还是在百度空间里面的&#xff0c;其实更早的是在csai&#xff0c;不过帐号&#xff0c;密码&#xff…

业务层勿用继承,不要为了方便舍弃了性能。TʌT不好意思我错了

很多人喜欢在action 或service或dao层继承一些公共的东西 比如jdbc或一些其他的东西 我看过一些小源码也经常这样 废话不多说 直入正题 直入正题前先科普一下TheardLocal类 懂的人直接跳 线程不安全指的是一个带有类成员变量&#xff08;状态&#xff09;的类的单列被多个线程访…

python棋盘最短路径_【leetcode】64. Minimum Path Sum 棋盘最短路径

1. 题目 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any point in time. 2. 思路 从右下往左上移动&#x…

linux kvm安装win7,ubuntu14.04 使用kvm安装win7系统

办公电脑从win7换成ubuntu已经有几个月了..环境:ubuntu 14.04kvm 2.0.0需要的各种软件也都安装的差不多了.. 迅雷 qq office vmware 等 这些我常用的软件也都安装上了..我的电脑配置也算可以了(thinkpad E 系列 i5 8G内存 )但是vmware这个东西在ubuntu上的表现不是那么让人满意…

Python 18.4 aiohttp

aiohttpasyncio可以实现单线程并发IO操作。如果仅用在客户端&#xff0c;发挥的威力不大。如果把asyncio用在服务器端&#xff0c;例如Web服务器&#xff0c;由于HTTP连接就是IO操作&#xff0c;因此可以用单线程coroutine实现多用户的高并发支持。asyncio实现了TCP、UDP、SSL等…

python函数和模块有什么特性_python-函数包和模块

python函数的作用&#xff1a; 在Python代码段中如果有一段几十行的代码&#xff0c;需要多次重复使用这几十行代码时&#xff0c;为了提高代码的可用性&#xff0c;将代码段放进函数体内&#xff0c;以后在使用中直接调用该函数模块即可&#xff0c;函数是一个独立的函数体或是…

hibernate继承映射之每个具体类一张表

数据模型 表person 表student 表worker 对象模型 Person private String id;private String name;private int age;private String sex; Student extends Person private String school; Worker extends Person private String factory; xml配置&#xff1a; <?xml version…

linux系统下安装qgis,深度操作系统 deepin 15.11安装 QGIS 3.4

深度操作系统是基于Linux内核&#xff0c;以桌面应用为主的开源 GNU/Linux 操作系统&#xff0c;支持笔记本、台式机和一体机。深度操作系统(deepin)包含深度桌面环境(DDE)和近30款深度原创应用&#xff0c;及数款来自开源社区的应用软件&#xff0c;支撑广大用户日常的学习和工…

读取并修改App.config文件(转载)

1. 向项目添加app.config文件&#xff1a;右击项目名称&#xff0c;选择“添加”→“添加新建项”&#xff0c;在出现的“添加新项”对话框中&#xff0c;选择“添加应用程序配置文件”&#xff1b;如果项目以前没有配置文件&#xff0c;则默认的文件名称为“app.config”&…

No resource found that matches the given name 'android:Widget.Material.A解决方案

1&#xff1a;首先新建空白工作区 2&#xff1a;先import appcompat_v7 appcompat_v7在一个类似这样的地方&#xff0c; C:\mywork\android\android-sdk-windows\extras\android\support\v7\appcompat 然后用import进来&#xff0c;像如下操作&#xff1a; 确保sdk是5.0及以上 …

python easygui进度条_Python _easygui详细版

1. msgbox msgbox(msg(Your message goes here), title , ok_buttonOK, imageNone, rootNone) msgbox() 显示一个消息和提供一个"OK"按钮&#xff0c;你可以指定任意的消息和标题&#xff0c;你甚至可以重写"OK"按钮的内容。 import easygui as g g.msgbox…

linux ubuntu bionic,尝试在Linux Ubuntu 18.04 Bionic上安装Docker CE时出现错误?

阅读包裹清单......完成构建依赖树阅读国家信息......完成将安装以下新软件包&#xff1a;docker-ce0升级&#xff0c;1新安装&#xff0c;0删除&#xff0c;0未升级 .需要获得 0 B/33 &#xff0c; 8 MB 的档案 .执行此操作后&#xff0c;将使用 181 MB 的额外磁盘空间 . (Rea…

数据库完整性约束1

SQL的安全机制:完整性定义约束&#xff0c;视图机制&#xff0c;对用户进行授权控制 完整性约束分类: 1).根据数据对象的状态可分为: 静态约束与动态约束 a.静态约束: 隐式约束和显式约束 隐式约束&#xff1a;隐含于数据模型中的完整性约束。关系模型的隐式约束有域约束和表约…

python入门文件读取与写入_初学者Python:读取和写入同一文件

每个打开的文件都有一个隐式指针&#xff0c;该指针指示将在何处读取和写入数据。通常&#xff0c;它默认为文件的开头&#xff0c;但是如果您使用a&#xff08;追加&#xff09;模式&#xff0c;则默认为文件的结尾。还值得注意的是&#xff0c;w即使您添加到该模式&#xff0…

swappiness

2019独角兽企业重金招聘Python工程师标准>>> swappiness参数位于&#xff1a;/etc/sysctl.cof swappiness0表示最大限度使用物理内存&#xff0c;然后才是swap空间。swappiness100的时候表示积极的使用swap分区&#xff0c;并把内存上的数据及时地搬运到swap空间…

宏基笔记本4740 Linux,宏基4740g拆机【教程详解】

笔记本电脑 使用久了内部会累积有灰尘&#xff0c;这些灰尘可能会影响到正常的使用;还有些人觉得笔记本电脑内存不够&#xff0c;想要加装个内存条;亦或想要帮助笔记本电脑换cpu等&#xff0c;这些都是需要将笔记本电脑拆卸下来&#xff0c;然后才能够完成好相关的工作。宏基47…