管理Google云数据目录标记导出脚本的包
datacatalog-tag-exporter的Python项目详细描述
Datacatalog标记导出器
管理Google云数据目录标记导出脚本的Python包。在
免责声明:这不是官方支持的谷歌产品。
目录
- Executing in Cloud Shell
- 1. Environment setup 在
- 2. Export Tags to CSV file 在
在云Shell中执行
# Set your SERVICE ACCOUNT, for instructions go to 1.3. Auth credentials# This name is just a suggestion, feel free to name it following your naming conventionsexportGOOGLE_APPLICATION_CREDENTIALS=~/datacatalog-tag-exporter-sa.json # Install datacatalog-tag-exporter pip3 install datacatalog-tag-exporter --user # Add to your PATHexportPATH=~/.local/bin:$PATH# Look for available commands datacatalog-tag-exporter --help
1。环境设置
1.1条。Python+virtualenv
使用virtualenv是可选的,但强烈建议您除非使用Docker。在
1.1.1。安装Python 3.6+
1.1.2。获取源代码
^{pr2}$下一步中以./
开头的所有路径都是相对于datacatalog-tag-exporter
文件夹。
1.1.3。创建并激活一个独立的Python环境
pip install --upgrade virtualenv
python3 -m virtualenv --python python3 env
source ./env/bin/activate
1.1.4。安装软件包
pip install --upgrade .
1.2条。Docker
Docker可以作为运行脚本的替代方法。在这种情况下,请忽略 Virtualenv安装说明。在
1.3条。身份验证凭据
1.3.1。创建服务帐户并授予其以下角色
- 数据目录管理员
此名称只是一个建议,请按照您的命名约定随意命名
./credentials/datacatalog-tag-exporter-sa.json
1.3.3。设置环境变量
如果使用Docker,则可以跳过此步骤。
exportGOOGLE_APPLICATION_CREDENTIALS=~/credentials/datacatalog-tag-exporter-sa.json
2。将标记导出到CSV文件
2.1条。将创建一个CSV文件列表,每个文件代表一个模板。
在同一个目录中还将创建一个包含每个模板统计信息的摘要文件。在
摘要文件的列描述如下:
Column | Description |
---|---|
template_name | Resource name of the Tag Template for the Tag. |
tags_count | Number of tags found from the template. |
tagged_entries_count | Number of tagged entries with the template. |
tagged_columns_count | Number of tagged columns with the template. |
tag_string_fields_count | Number of used String fields on tags of the template. |
tag_bool_fields_count | Number of used Bool fields on tags of the template. |
tag_double_fields_count | Number of used Double fields on tags of the template. |
tag_timestamp_fields_count | Number of used Timestamp fields on tags of the template. |
tag_enum_fields_count | Number of used Enum fields on tags of the template. |
每个模板文件的列描述如下:
^{tb2}$2.2条。运行datacatalog标记导出器脚本
- Python+virtualenv
datacatalog-tag-exporter tags export --project-ids my-project --dir-path DIR_PATH
2.2.1运行datacatalog标记导出器过滤标记模板
- Python+virtualenv
datacatalog-tag-exporter tags export --project-ids my-project \ --dir-path DIR_PATH \ --tag-templates-names projects/my-project/locations/us-central1/tagTemplates/my-template,\ projects/my-project/locations/us-central1/tagTemplates/my-template-2
历史
0.1.0(2020-04-15)
- PyPI的第一个版本。在
0.2.0(2020-05-08)
- 添加了在创建日期后导出标记的选项。在
- 项目
标签: