Skip to content

feat(export-to-core): add Looker Core export tools - #34

Merged
mkidambi0108 merged 4 commits into
mainfrom
feat/export-to-core
Nov 19, 2026
Merged

mkidambi0108 merged 4 commits into
mainfrom
feat/export-to-core

Conversation

@mkidambi0108

Copy link
Copy Markdown
Contributor

Summary

Adds export-to-core/, providing self-service customer-hosted (on-premises / IaaS) Looker to Looker (Google Cloud core) diagnostic, export, and encryption tooling:

  • looker_export.py (Unified Export & Encryption Script):
    • Pre-flight validation: Verifies required system binaries, minimum versions (Python >= 3.9, git >= 2.36, MySQL >= 8.0 / MariaDB >= 10.4), free local staging disk capacity (1.5x peak space), Application Default Credentials (gcloud auth application-default login or GOOGLE_APPLICATION_CREDENTIALS .json service account key validation), Cloud KMS symmetric key access, and RFC 3394 AES Key Unwrap of the active Looker encryption_key KEK using LOOKER_MASTER_KEY.
    • Read-only database extraction: Supports both single-threaded (mysqldump + gzip) and multi-threaded (mydumper >= 0.16.0 + zstd) non-locking extraction, applying collation/schema normalization (utf8mb4_general_ci, BIGINT(19) compatibility), schema-only export of oauth_user_state, optional schedule disabling (DISABLE_SCHEDULED_PLANS=true by default), and selective setting row preservation (crypt_canary_gcm and closed_system) strictly on staged output files without modifying the live source database.
    • File system staging & Git normalization: Stages supported Looker directories (models, bare_models, deploy_keys, git_hooks, models-self-service, models-user-looker, remote_dependencies, and .persistent_store) and normalizes Git/SSH paths for Looker (Google Cloud core).
    • Envelope encryption & manifest: Wraps the 32-byte LOOKER_MASTER_KEY with the customer's Cloud KMS CMEK, encrypts database and file system archives using Tink Streaming AEAD (AES128_CTR_HMAC_SHA256_1MB) with Cloud KMS Envelope AEAD handles, and writes final_artifacts/ (mysql-data, mysql-handle, fs-data, fs-handle, metadata.json) with 0600 permissions.
  • collect_looker_diagnostics.py (Optional Pre-Migration Diagnostics):
    • Standard-library, read-only diagnostic script that inspects Looker application/shared directory disk usage (du -hs), directory tree layout (excluding models-user-[0-9]* developer directories), total database footprint (Database Size Summary: total_db_bytes, total_db_mib, total_db_gib, and estimated 1.5x staging disk space), and per-table version/charset/collation/size sorted largest-first.
  • export-to-core/README.md & root README.md:
    • Documents prerequisites, required Cloud KMS (roles/cloudkms.cryptoKeyEncrypterDecrypter) and Cloud Storage (roles/storage.objectUser / roles/storage.objectAdmin) IAM permissions for interactive ADC or GOOGLE_APPLICATION_CREDENTIALS .json service account keys, configuration variables, output deliverables, and test execution.
  • export-to-core/tests/test_export_to_core.py:
    • Hermetic unit and end-to-end test suite covering key validation, database extraction/normalization, directory staging, Tink Streaming AEAD + Cloud KMS envelope encryption round-trips, and diagnostic reporting.

Testing

cd export-to-core
python3 -m unittest discover -s tests -p 'test_*.py' -v

@mkidambi0108
mkidambi0108 requested a review from a team as a code owner November 16, 2026 06:35

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive set of tools for migrating customer-hosted Looker instances to Looker (Google Cloud core). It includes a unified export script (looker_export.py) that handles pre-flight validation, database extraction (supporting both mysqldump and mydumper), filesystem staging, and secure artifact encryption using Cloud KMS and Tink. Additionally, a diagnostic script (collect_looker_diagnostics.py) is provided for pre-migration analysis. The review identified two technical improvements: a fix for non-portable os.fsync usage on read-only file descriptors and a robustness improvement for signal registration in multi-threaded environments.

Comment thread export-to-core/looker_export.py Resolved
Comment thread export-to-core/looker_export.py Resolved
Comment thread export-to-core/looker_export.py Resolved
@mkidambi0108
mkidambi0108 requested a review from a team as a code owner November 19, 2026 16:44
@mkidambi0108
mkidambi0108 merged commit b1cb6b1 into main Nov 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants