Package for ingesting Looker metadata into Google Cloud Data Catalog
Project description
google-datacatalog-looker-connector
Package for ingesting Looker metadata into Google Cloud Data Catalog, currently supporting below asset types:
- Folder
- Look
- Dashboard
- Dashboard Element (aka Tile)
- Query
Disclaimer: This is not an officially supported Google product.
Table of Contents
1. Installation
Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.
With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies. Make sure you use Python 3.7+.
1.1. Mac/Linux
pip3 install virtualenv
virtualenv --python python3.7 <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-datacatalog-looker-connector
1.2. Windows
pip3 install virtualenv
virtualenv --python python3.7 <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-datacatalog-looker-connector
1.3. Install from source
1.3.1. Get the code
git clone https://github.com/GoogleCloudPlatform/datacatalog-connectors-bi/
cd datacatalog-connectors-bi/google-datacatalog-looker-connector
1.3.2. Create and activate a virtualenv
pip3 install virtualenv
virtualenv --python python3.7 <your-env>
source <your-env>/bin/activate
1.3.3. Install the library
pip install .
2. Environment setup
2.1. Auth credentials
2.1.1. Create a GCP Service Account and grant it below roles
- Data Catalog Admin
2.1.2. Download a JSON key and save it as
<YOUR-CREDENTIALS_FILES_FOLDER>/looker2dc-datacatalog-credentials.json
2.1.3. Create Looker API3 credentials
The credentials required for API access must be obtained by creating an
API3 key on a user account in the Looker Admin console. The API3 key consists
of a public client_id
and a private client_secret
.
The shortcut for Looker Admin console is https:///admin/users/api3_key/
2.1.4. Create a Looker configuration file
File content is described in Looker SDK documentation.
Save the file as
<YOUR-CREDENTIALS_FILES_FOLDER>/looker2dc-looker-credentials.ini
Please notice this folder and files will be required in next steps.
2.2. Set environment variables
export GOOGLE_APPLICATION_CREDENTIALS=datacatalog_credentials_file
Replace above values according to your environment. The Data Catalog credentials file was saved in step 1.2.2.
3. Run entry point
3.1. Run Python entry point
- Virtualenv
google-datacatalog-looker-connector \
--datacatalog-project-id <YOUR-DATACATALOG-PROJECT-ID> \
--looker-credentials-file looker_credentials_ini_file
3.2. Run Docker entry point
docker build --rm --tag looker2datacatalog .
docker run --rm --tty -v <YOUR-CREDENTIALS_FILES_FOLDER>:/data \
looker2datacatalog \
--datacatalog-project-id <YOUR-DATACATALOG-PROJECT-ID> \
--looker-credentials-file /data/looker2dc-looker-credentials.ini
4. Developer environment
4.1. Install and run Yapf formatter
pip install --upgrade yapf
# Auto update files
yapf --in-place --recursive src tests
# Show diff
yapf --diff --recursive src tests
# Set up pre-commit hook
# From the root of your git project.
curl -o pre-commit.sh https://raw.githubusercontent.com/google/yapf/master/plugins/pre-commit.sh
chmod a+x pre-commit.sh
mv pre-commit.sh .git/hooks/pre-commit
4.2. Install and run Flake8 linter
pip install --upgrade flake8
flake8 src tests
4.3. Run Tests
python setup.py test
5. Troubleshooting
In the case a connector execution hits Data Catalog quota limit, an error will be raised and logged with the following detailment, depending on the performed operation READ/WRITE/SEARCH:
status = StatusCode.RESOURCE_EXHAUSTED
details = "Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute' of service 'datacatalog.googleapis.com' for consumer 'project_number:1111111111111'."
debug_error_string =
"{"created":"@1587396969.506556000", "description":"Error received from peer ipv4:172.217.29.42:443","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute' of service 'datacatalog.googleapis.com' for consumer 'project_number:1111111111111'.","grpc_status":8}"
For more information on Data Catalog quota, please refer to: Data Catalog quota docs.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file google-datacatalog-looker-connector-0.5.0.tar.gz
.
File metadata
- Download URL: google-datacatalog-looker-connector-0.5.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b80f93188ab556f6f6ae1f59c33509db7ba9ec5eddc8d24268fe61e2f82513ad |
|
MD5 | 3a628b420de5685185020d60bbe70f56 |
|
BLAKE2b-256 | c7cc62266b46ff44dab2935b6fbb19d5195c2f0abebdc6b380fed2bb0bb0918e |
File details
Details for the file google_datacatalog_looker_connector-0.5.0-py2.py3-none-any.whl
.
File metadata
- Download URL: google_datacatalog_looker_connector-0.5.0-py2.py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f568e2a8cee55e898322b0cb3cd06eabab108302fa4e6a9650436ae5e7ec446 |
|
MD5 | 6bee16eb11f1d15a3a596bf9cf2a7313 |
|
BLAKE2b-256 | 34bd6fc3fd387715f4a4a416608c90bc8c48d2ff201087a854e1e4c49f926e5a |