外观清理工具
henr的Python项目详细描述
亨利:一个旁观者清理工具
henry是一个命令行工具,可以帮助确定looker实例中的模型膨胀,并识别模型和探索中未使用的内容。它旨在帮助开发人员从未使用的探索中清理模型,并从未使用的连接和字段中探索,以及维护一个健康且用户友好的实例。
目录
- Henry: A Looker Cleanup Tool
Status and Support
Henry is NOT supported or warranted by Looker in any way. Please do not contact Looker support for issues with Henry. Issues can be logged via https://github.com/looker-open-source/henry/issues
Where to get it
The source code is currently hosted on GitHub at https://github.com/looker-open-source/henry/。最新发布的版本可以在PyPI上找到,并可以使用:
$ pip install henry
对于开发设置,请遵循开发设置below。
Usage
In order to display usage information, use:
^{pr 2}$Storing Credentials
API3 login credentials can be specified at runtime using various flags or more conveniently, using a ^{
Make sure that the ^{
If ^{
Global Config File
A global settings file called ^{
API timeout settings
The ^{
Config Path
The ^{
按照优先顺序,以下是用于定义凭据文件路径位置的方法: --路径,在~/.henry/settings.json中配置路径,然后是默认值。
Global Options that apply to many commands
Suppressing Formatted Output
Many commands provide tabular output. For tables the option ^{
Output to File
Using the ^{
saves the results to unused_explores.csv in the current working directory.
Pulse Command
The command ^{
Connection Checks
Runs specific tests for each connection to make sure the connection is in working order. If any tests fail, the output will show which tests passed or failed for that particular connection. Example:
^{pr 6}$Query Stats
Checks how many queries were run over the past 30 days and how many of them errored or got killed as well as some statistics around runtimes times. The IDs of queries that took more than 5 times the average query runtime are also outputted.
Scheduled Plans
Determines the number of scheduled jobs that ran in the past 30 days, how many were successful, how many ran but did not deliver or failed to run altogether.
Legacy Features
Outputs a list of legacy features that are still in use if any. These are features that have been replaced with improved ones and should be moved away from.
Version
Checks if the latest Looker version is being used. Looker supports only up to 3 releases back.
Analyze Command
The ^{
analyze projects
The ^{
analyze models
Shows the number of explores in each model as well as the number of queries against that model.
^{pr 8}$analyze explores
Shows explores and their usage. If the ^{
Vacuum Information
The ^{
vacuum models
The ^{
vacuum explores
The ^{
Example: from the analyze function run above,我们知道队列探索有4个字段在过去90天内没有被查询过一次。运行以下真空命令:
$ henry vacuum explores --model thelook --explore cohorts
提供未使用字段的名称:
+---------+-----------+----------------+------------------------------+
| model | explore | unused_joins | unused_fields |
|---------+-----------+----------------+------------------------------|
| thelook | cohorts | N/A | order_items.created_date |
| | | | order_items.id |
| | | | order_items.total_sale_price |
| | | | users.gender |
+---------+-----------+----------------+------------------------------+
需要注意的是,在一个探索中清空字段的字段并不意味着完全从视图文件中删除,因为它们可能在其他探索或联接中使用。相反,应该使用fieldslookml参数隐藏这些字段(如果它们在其他地方没有使用),或者将它们从explore中排除。
Logging
The tool logs activity as it's being used. Log files are stored in ^{
The logging module utilises a rotating file handler which is currently set to rollover when the current log file reaches 500 KB in size. The system saves old log files by adding the suffix '.1', '.2' etc., to the filename. The file being written to is always named ^{
Dependencies
Development
To install henry in development mode you need to install the dependencies above and clone the project's repo with:
^{pr 13}$You can then install using:
^{pr 14}$Alternatively, you can use ^{
$ pip install -e .
Authors
Henry has primarily been developed by Joseph Axisa。见all contributors。
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/looker-open-source/henry/issues。这个项目旨在成为一个安全、受欢迎的协作空间,而且贡献者应该遵守Contributor Covenant行为准则。
Code of Conduct
Everyone interacting in the Henry project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct。
Copyright
Copyright (c) 2018 Joseph Axisa for Looker Data Sciences. See MIT License了解更多详细信息。