![image](https://github.com/looker-open-source/henry/blob/master/doc/logo/logo.png?raw=true)
---
# Henry: A Looker Cleanup Tool
Henry is a command line tool that helps determine model bloat in your Looker instance and identify unused content in models and explores. It is meant to help developers cleanup models from unused explores and explores from unused joins and fields, as well as maintain a healthy and user-friendly instance.
## Table of Contents
- [Henry: A Looker Cleanup Tool](#henry-a-looker-cleanup-tool)
- [Table of Contents](#table-of-contents)
- [Status and Support](#status-and-support)
- [Installation](#installation)
- [Usage](#usage)
- [Global Options that apply to many commands](#global-options-that-apply-to-many-commands)
- [API timeout settings](#api-timeout-settings)
- [Output to File](#output-to-file)
- [Pulse Command](#pulse-command)
- [Analyze Command](#analyze-command)
- [analyze projects](#analyze-projects)
- [analyze models](#analyze-models)
- [analyze explores](#analyze-explores)
- [Vacuum Information](#vacuum-information)
- [vacuum models](#vacuum-models)
- [vacuum explores](#vacuum-explores)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Copyright](#copyright)
<a name="status_and_support"></a>
## 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
<a name="where_to_get_it"></a>
## Installation
Henry requires python3.7+. It is published on [PyPI](https://pypi.org/project/henry/) and can be installed using pip:
$ pip install henry
For development setup, follow the Development setup [below](#development).
<a name="usage"></a>
## Usage
In order to display usage information, use:
$ henry --help
<a name="global_options"></a>
### Global Options that apply to many commands
<a name="authentication"></a>
#### Authentication
Henry makes use of the [Looker SDK](https://github.com/looker-open-source/sdk-codegen/tree/master/python) to issue API calls and requires API3 credentials. These can provided either using an .ini file or environment variables as documented [here](https://github.com/looker-open-source/sdk-codegen#environment-variable-configuration). By default, the tool looks for a "looker.ini" file in the working directory. If the configuration file is named differently or located elsewhere, it must be specified using the `--config-file` argument.
Example .ini file:
```
[Looker]
# Base URL for API. Do not include /api/* in the url
base_url=https://self-signed.looker.com:19999
# API 3 client id
client_id=YourClientID
# API 3 client secret
client_secret=YourClientSecret
# Set to false if testing locally against self-signed certs. Otherwise leave True
verify_ssl=True
[Production]
base_url=https://production.looker.com:19999
client_id=YourClientID
client_secret=YourClientSecret
verify_ssl=True
```
Assuming the above ini file contents, Henry can be run as follows:
$ henry pulse --config-file=looker.ini --section=Looker
which due to defaults, is equivalent to
$ henry pulse
Running it using the details under the `Production` section can be done as follows:
$ henry pulse --section=Production
<a name="api_timeout_settings"></a>
#### API timeout settings
By default, API calls have a timeout of 120 seconds. This can be overriden using the `--timeout` argument.
<a name="output_to_file"></a>
#### Output to File
If the `--save` flag is used the tool saves the results to your current working directory. Example usage:
$ henry vacuum models --save
saves the results in _vacuum_models\_{date}\_{time}.csv_ in the current working directory.
<a name="pulse_cmd"></a>
### Pulse Command
The command `henry pulse` runs a number of tests that help determine the overall instance health.
<a name="analyze_cmd"></a>
### Analyze Command
The `analyze` command is meant to help identify models and explores that have become bloated and use `vacuum` on them in order to trim them.
<a name="analyze_projects"></a>
#### analyze projects
The `analyze projects` command scans projects for their content as well as checks for the status of quintessential features for success such as the git connection status and validation requirements.
```
+-------------------+---------------+--------------+-------------------------+---------------------+------------------------+
| Project | # Models | # View Files | Git Connection Status | PR Mode | Is Validation Required |
|-------------------+---------------+--------------+-------------------------+---------------------+------------------------|
| marketing | 1 | 13 | OK | links | True |
| admin | 2 | 74 | OK | off | True |
| powered_by_looker | 1 | 14 | OK | links | True |
| salesforce | 1 | 36 | OK | required | False |
| thelook_event | 1 | 17 | OK | required | True |
+-------------------+---------------+--------------+-------------------------+---------------------+------------------------+
```
<a name="analyze_models"></a>
#### analyze models
Shows the number of explores in each model as well as the number of queries against that model.
```
+-------------------+------------------+-----------------+-------------------+-------------------+
| Project | Model | # Explores | # Unused Explores | Query Count |
|-------------------+------------------+-----------------+-------------------+-------------------|
| salesforce | salesforce | 8 | 0 | 39923 |
| thelook_event | thelook | 10 | 0 | 166307 |
| powered_by_looker | powered_by | 5 | 0 | 49122 |
| marketing | thelook_adwords | 3 | 0 | 40869 |
| admin | looker_base | 0 | 0 | 0 |
| admin | looker_on_looker | 10 | 9 | 28 |
+-------------------+------------------+-----------------+-------------------+-------------------+
```
<a name="analyze_explores"></a>
#### analyze explores
Shows explores and their usage. If the `--min-queries` argument is passed, joins and fields that have been used less than the threshold specified will be considered as unused.
```
+---------+-----------------------------------------+-------------+-------------------+--------------+----------------+---------------+-----------------+---------------+
| Model | Explore | Is Hidden | Has Description | # Joins | # Unused Joins | # Fields | # Unused Fields | Query Count |
|---------+-----------------------------------------+-------------+-------------------+--------------+----------------+---------------+-----------------+---------------|
| thelook | cohorts | True | False | 3 | 0 | 19 | 4 | 333 |
| thelook | data_tool | True | False | 3 | 0 | 111 | 90 | 736 |
| thelook | order_items | False | True | 7 | 0 | 153 | 16 | 126898 |
| thelook | events | False | True | 6 | 0 | 167 | 68 | 19372 |
| thelook | sessions | False | False | 6 | 0 | 167 | 83 | 12205 |
| thelook | affinity | False | False | 2 | 0 | 34 | 13 | 3179 |
| thelook | orders_with_share_of_wallet_application | False | True | 9 | 0 | 161 | 140 | 1586 |
| thelook | journey_mapping | False | False | 11 | 2 | 238 | 228 | 14 |
| thelook | inventory_snapshot | False | False | 3 | 0 | 25 | 15 | 33 |
| thelook | kitten_order_items | True | False | 8 | 0 | 154 | 138 | 39 |
+---------+-----------------------------------------+-------------+-------------------+--------------+----------------+---------------+-----------------+---------------+
```
<a name="vacuum_cmd"></a>
### Vacuum Information
The `vacuum` command outputs a list of unused content based on predefined criteria that a developer can then use to cleanup models and explores.
<a name="vacuum_models"></a>
#### vacuum models
The `vacuum models` command exposes models and the number of queries against them over a predefined period of time. Explores that are listed here have not had the minimum number of queries against them in the timeframe specified. As a result it is safe to hide them and later delete them.
```
+------------------+---------------------------------------------+-------------------------+
| Model | Explore | Model Query Count |
|------------------+---------------------------------------------+-------------------------|
| salesforce | | 39450 |
| thelook | | 164930 |
| powered_by | | 49453 |
| thelook_adwords | | 38108 |
| looker_on_looker | user_full | 27 |
| | history_full | |
| | content_view | |
| | project_status | |
| | field_usage_full | |
| | dashboard_performance_full | |
| | user_weekly_app_activity_period_over_period | |
| | pdt_state | |
| | user_daily_query_activity | |
+------------------+---------------------------------------------+-------------------------+
```
<a name="vacuum_explores"></a>
#### vacuum explores
The `vacuum explores` command exposes joins & exposes fields that are below or equal to the minimum number of queries threshold (default=0, can be changed using the `--min-queries` argument) over the specified timeframe (default: 90, can be changed using the `--timeframe` argument).
Example: from the analyze function run [above](#analyze_explores), we know that the cohorts explore has 4 fields that haven't been queried once in the past 90 days. Running the following vacuum command:
$ henry vacuum explores --model thelook --explore cohorts
provides the name of the unused fields:
```
+---------+-----------+----------------+------------------------------+
| Model | Explore | Unused Joins | Unused Fields |
|---------+-----------+----------------+------------------------------|
| thelook | cohorts | users | users.id |
| | | | order_items.id |
| | | | order_items.id |
| | | | order_items.total_sale_price |
+---------+-----------+----------------+------------------------------+
```
If a join is unused, it's implying that fields introduced by that join haven't been used for the defined timeframe. For this reason fields exposed as a result of that join are not explicitly listed as unused fields.
It is very important to note that fields listed as unused in one explore are not meant to be completely removed from view files altogether because they might be used in other explores (via extensions), or filters. Instead, one should either hide those fields (if they're not used anywhere else) or exclude them from the explore using the _fields_ LookML parameter.
<a name="contributing"></a>
## Contributing
Please refer to the [CONTRIBUTING file](https://github.com/looker-open-source/henry/blob/master/CONTRIBUTING.md). Bug reports and pull requests are welcome on GitHub at https://github.com/looker-open-source/henry/issues.
<a name="code_of_conduct"></a>
## 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](https://github.com/looker-open-source/henry/blob/master/CODE_OF_CONDUCT.md).
<a name="copyright"></a>
## Copyright
Copyright (c) 2018 Joseph Axisa for Looker Data Sciences. See [MIT License](LICENSE.txt) for further details.
Raw data
{
"_id": null,
"home_page": "https://pypi.python.org/pypi/henry",
"name": "henry-temp-fix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7.0",
"maintainer_email": null,
"keywords": "Looker Cleanup, Looker Henry, Henry",
"author": "Joseph Axisa",
"author_email": "jax@looker.com",
"download_url": "https://files.pythonhosted.org/packages/24/0c/01d692bc809b5774943aff4957748cd9f7b3cf48253925c2c1433f7a4372/henry-temp-fix-1.1.2.tar.gz",
"platform": null,
"description": "![image](https://github.com/looker-open-source/henry/blob/master/doc/logo/logo.png?raw=true)\n\n---\n\n# Henry: A Looker Cleanup Tool\n\nHenry is a command line tool that helps determine model bloat in your Looker instance and identify unused content in models and explores. It is meant to help developers cleanup models from unused explores and explores from unused joins and fields, as well as maintain a healthy and user-friendly instance.\n\n## Table of Contents\n\n- [Henry: A Looker Cleanup Tool](#henry-a-looker-cleanup-tool)\n - [Table of Contents](#table-of-contents)\n - [Status and Support](#status-and-support)\n - [Installation](#installation)\n - [Usage](#usage)\n - [Global Options that apply to many commands](#global-options-that-apply-to-many-commands)\n - [API timeout settings](#api-timeout-settings)\n - [Output to File](#output-to-file)\n - [Pulse Command](#pulse-command)\n - [Analyze Command](#analyze-command)\n - [analyze projects](#analyze-projects)\n - [analyze models](#analyze-models)\n - [analyze explores](#analyze-explores)\n - [Vacuum Information](#vacuum-information)\n - [vacuum models](#vacuum-models)\n - [vacuum explores](#vacuum-explores)\n - [Contributing](#contributing)\n - [Code of Conduct](#code-of-conduct)\n - [Copyright](#copyright)\n\n<a name=\"status_and_support\"></a>\n\n## Status and Support\n\nHenry is **NOT** supported or warranted by Looker in any way. Please do not contact Looker support\nfor issues with Henry. Issues can be logged via https://github.com/looker-open-source/henry/issues\n\n<a name=\"where_to_get_it\"></a>\n\n## Installation\n\nHenry requires python3.7+. It is published on [PyPI](https://pypi.org/project/henry/) and can be installed using pip:\n\n $ pip install henry\n\nFor development setup, follow the Development setup [below](#development).\n\n<a name=\"usage\"></a>\n\n## Usage\n\nIn order to display usage information, use:\n\n $ henry --help\n\n<a name=\"global_options\"></a>\n\n### Global Options that apply to many commands\n\n<a name=\"authentication\"></a>\n\n#### Authentication\n\nHenry makes use of the [Looker SDK](https://github.com/looker-open-source/sdk-codegen/tree/master/python) to issue API calls and requires API3 credentials. These can provided either using an .ini file or environment variables as documented [here](https://github.com/looker-open-source/sdk-codegen#environment-variable-configuration). By default, the tool looks for a \"looker.ini\" file in the working directory. If the configuration file is named differently or located elsewhere, it must be specified using the `--config-file` argument.\n\nExample .ini file:\n\n```\n[Looker]\n# Base URL for API. Do not include /api/* in the url\nbase_url=https://self-signed.looker.com:19999\n# API 3 client id\nclient_id=YourClientID\n# API 3 client secret\nclient_secret=YourClientSecret\n# Set to false if testing locally against self-signed certs. Otherwise leave True\nverify_ssl=True\n\n[Production]\nbase_url=https://production.looker.com:19999\nclient_id=YourClientID\nclient_secret=YourClientSecret\nverify_ssl=True\n```\n\nAssuming the above ini file contents, Henry can be run as follows:\n\n $ henry pulse --config-file=looker.ini --section=Looker\n\nwhich due to defaults, is equivalent to\n\n $ henry pulse\n\nRunning it using the details under the `Production` section can be done as follows:\n\n $ henry pulse --section=Production\n\n<a name=\"api_timeout_settings\"></a>\n\n#### API timeout settings\n\nBy default, API calls have a timeout of 120 seconds. This can be overriden using the `--timeout` argument.\n\n<a name=\"output_to_file\"></a>\n\n#### Output to File\n\nIf the `--save` flag is used the tool saves the results to your current working directory. Example usage:\n\n $ henry vacuum models --save\n\nsaves the results in _vacuum_models\\_{date}\\_{time}.csv_ in the current working directory.\n\n<a name=\"pulse_cmd\"></a>\n\n### Pulse Command\n\nThe command `henry pulse` runs a number of tests that help determine the overall instance health.\n\n<a name=\"analyze_cmd\"></a>\n\n### Analyze Command\n\nThe `analyze` command is meant to help identify models and explores that have become bloated and use `vacuum` on them in order to trim them.\n\n<a name=\"analyze_projects\"></a>\n\n#### analyze projects\n\nThe `analyze projects` command scans projects for their content as well as checks for the status of quintessential features for success such as the git connection status and validation requirements.\n\n```\n+-------------------+---------------+--------------+-------------------------+---------------------+------------------------+\n| Project | # Models | # View Files | Git Connection Status | PR Mode | Is Validation Required |\n|-------------------+---------------+--------------+-------------------------+---------------------+------------------------|\n| marketing | 1 | 13 | OK | links | True |\n| admin | 2 | 74 | OK | off | True |\n| powered_by_looker | 1 | 14 | OK | links | True |\n| salesforce | 1 | 36 | OK | required | False |\n| thelook_event | 1 | 17 | OK | required | True |\n+-------------------+---------------+--------------+-------------------------+---------------------+------------------------+\n```\n\n<a name=\"analyze_models\"></a>\n\n#### analyze models\n\nShows the number of explores in each model as well as the number of queries against that model.\n\n```\n+-------------------+------------------+-----------------+-------------------+-------------------+\n| Project | Model | # Explores | # Unused Explores | Query Count |\n|-------------------+------------------+-----------------+-------------------+-------------------|\n| salesforce | salesforce | 8 | 0 | 39923 |\n| thelook_event | thelook | 10 | 0 | 166307 |\n| powered_by_looker | powered_by | 5 | 0 | 49122 |\n| marketing | thelook_adwords | 3 | 0 | 40869 |\n| admin | looker_base | 0 | 0 | 0 |\n| admin | looker_on_looker | 10 | 9 | 28 |\n+-------------------+------------------+-----------------+-------------------+-------------------+\n```\n\n<a name=\"analyze_explores\"></a>\n\n#### analyze explores\n\nShows explores and their usage. If the `--min-queries` argument is passed, joins and fields that have been used less than the threshold specified will be considered as unused.\n\n```\n+---------+-----------------------------------------+-------------+-------------------+--------------+----------------+---------------+-----------------+---------------+\n| Model | Explore | Is Hidden | Has Description | # Joins | # Unused Joins | # Fields | # Unused Fields | Query Count |\n|---------+-----------------------------------------+-------------+-------------------+--------------+----------------+---------------+-----------------+---------------|\n| thelook | cohorts | True | False | 3 | 0 | 19 | 4 | 333 |\n| thelook | data_tool | True | False | 3 | 0 | 111 | 90 | 736 |\n| thelook | order_items | False | True | 7 | 0 | 153 | 16 | 126898 |\n| thelook | events | False | True | 6 | 0 | 167 | 68 | 19372 |\n| thelook | sessions | False | False | 6 | 0 | 167 | 83 | 12205 |\n| thelook | affinity | False | False | 2 | 0 | 34 | 13 | 3179 |\n| thelook | orders_with_share_of_wallet_application | False | True | 9 | 0 | 161 | 140 | 1586 |\n| thelook | journey_mapping | False | False | 11 | 2 | 238 | 228 | 14 |\n| thelook | inventory_snapshot | False | False | 3 | 0 | 25 | 15 | 33 |\n| thelook | kitten_order_items | True | False | 8 | 0 | 154 | 138 | 39 |\n+---------+-----------------------------------------+-------------+-------------------+--------------+----------------+---------------+-----------------+---------------+\n```\n\n<a name=\"vacuum_cmd\"></a>\n\n### Vacuum Information\n\nThe `vacuum` command outputs a list of unused content based on predefined criteria that a developer can then use to cleanup models and explores.\n\n<a name=\"vacuum_models\"></a>\n\n#### vacuum models\n\nThe `vacuum models` command exposes models and the number of queries against them over a predefined period of time. Explores that are listed here have not had the minimum number of queries against them in the timeframe specified. As a result it is safe to hide them and later delete them.\n\n```\n+------------------+---------------------------------------------+-------------------------+\n| Model | Explore | Model Query Count |\n|------------------+---------------------------------------------+-------------------------|\n| salesforce | | 39450 |\n| thelook | | 164930 |\n| powered_by | | 49453 |\n| thelook_adwords | | 38108 |\n| looker_on_looker | user_full | 27 |\n| | history_full | |\n| | content_view | |\n| | project_status | |\n| | field_usage_full | |\n| | dashboard_performance_full | |\n| | user_weekly_app_activity_period_over_period | |\n| | pdt_state | |\n| | user_daily_query_activity | |\n+------------------+---------------------------------------------+-------------------------+\n```\n\n<a name=\"vacuum_explores\"></a>\n\n#### vacuum explores\n\nThe `vacuum explores` command exposes joins & exposes fields that are below or equal to the minimum number of queries threshold (default=0, can be changed using the `--min-queries` argument) over the specified timeframe (default: 90, can be changed using the `--timeframe` argument).\n\nExample: from the analyze function run [above](#analyze_explores), we know that the cohorts explore has 4 fields that haven't been queried once in the past 90 days. Running the following vacuum command:\n\n $ henry vacuum explores --model thelook --explore cohorts\n\nprovides the name of the unused fields:\n\n```\n+---------+-----------+----------------+------------------------------+\n| Model | Explore | Unused Joins | Unused Fields |\n|---------+-----------+----------------+------------------------------|\n| thelook | cohorts | users | users.id |\n| | | | order_items.id |\n| | | | order_items.id |\n| | | | order_items.total_sale_price |\n+---------+-----------+----------------+------------------------------+\n```\n\nIf a join is unused, it's implying that fields introduced by that join haven't been used for the defined timeframe. For this reason fields exposed as a result of that join are not explicitly listed as unused fields.\n\nIt is very important to note that fields listed as unused in one explore are not meant to be completely removed from view files altogether because they might be used in other explores (via extensions), or filters. Instead, one should either hide those fields (if they're not used anywhere else) or exclude them from the explore using the _fields_ LookML parameter.\n\n<a name=\"contributing\"></a>\n\n## Contributing\n\nPlease refer to the [CONTRIBUTING file](https://github.com/looker-open-source/henry/blob/master/CONTRIBUTING.md). Bug reports and pull requests are welcome on GitHub at https://github.com/looker-open-source/henry/issues.\n\n<a name=\"code_of_conduct\"></a>\n\n## Code of Conduct\n\nEveryone interacting in the Henry project\u2019s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/looker-open-source/henry/blob/master/CODE_OF_CONDUCT.md).\n\n<a name=\"copyright\"></a>\n\n## Copyright\n\nCopyright (c) 2018 Joseph Axisa for Looker Data Sciences. See [MIT License](LICENSE.txt) for further details.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Looker Cleanup Tool",
"version": "1.1.2",
"project_urls": {
"Homepage": "https://pypi.python.org/pypi/henry"
},
"split_keywords": [
"looker cleanup",
" looker henry",
" henry"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "473331a2fd4ef9c2c04eeeb85c043f28788937f8be784d1bb6574bd509955ccf",
"md5": "dd0ee0224c5af1297573661708be22a5",
"sha256": "0be1171f5cc166c5a6c7df8de4557491dbbed7fc10f4093698cacab3653cd254"
},
"downloads": -1,
"filename": "henry_temp_fix-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dd0ee0224c5af1297573661708be22a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.0",
"size": 19430,
"upload_time": "2024-08-19T19:37:46",
"upload_time_iso_8601": "2024-08-19T19:37:46.163625Z",
"url": "https://files.pythonhosted.org/packages/47/33/31a2fd4ef9c2c04eeeb85c043f28788937f8be784d1bb6574bd509955ccf/henry_temp_fix-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "240c01d692bc809b5774943aff4957748cd9f7b3cf48253925c2c1433f7a4372",
"md5": "c6e0349c7dd0a8f954e8e97be598a0c2",
"sha256": "7adee1a2de8a34681b993015d39b09c71ccf73f664ce442698f4dab02cd0ad6b"
},
"downloads": -1,
"filename": "henry-temp-fix-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "c6e0349c7dd0a8f954e8e97be598a0c2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.0",
"size": 19327,
"upload_time": "2024-08-19T19:37:47",
"upload_time_iso_8601": "2024-08-19T19:37:47.699567Z",
"url": "https://files.pythonhosted.org/packages/24/0c/01d692bc809b5774943aff4957748cd9f7b3cf48253925c2c1433f7a4372/henry-temp-fix-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-19 19:37:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "henry-temp-fix"
}