Skip to main content

`dataform_cli` is a lightweight Python-based command-line interface (CLI) designed to simplify **file synchronization between local directories and Google Cloud Dataform workspaces**.

Project description

Dataform CLI

🎯 Objective & Motivation

dataform_cli is a lightweight Python-based command-line interface (CLI) designed to simplify file synchronization between local directories and Google Cloud Dataform workspaces. The primary goal is to accelerate development workflows by allowing easy push and pull operations of .sqlx, .js, and other source files while respecting .gitignore rules.

It helps developers:

  • Avoid repetitive UI interactions.
  • Manage versioning consistently with .gitignore.
  • Automate CI/CD tasks for Dataform repositories.

🚀 Features

  • ✅ Push local files to a specified Dataform workspace.
  • ✅ Pull files from a Dataform workspace to a local directory.
  • ✅ Support for .gitignore filtering.
  • ✅ Optional automatic commit and git push on file upload.
  • ✅ Fixed-width logging with timestamps and log levels.
  • ✅ Easy integration with Python projects or automation scripts.

💻 Usage Examples

Push files to Dataform

python -m surquest.GCP.dataform_cli push \
  --project-id=my-gcp-project \
  --region=europe-west1 \
  --repository-id=my-repo \
  --workspace-id=dev \
  --source-dir=./src

Optional flags:

  • --no-delete-remote-files: Do not remove remote files not present locally.
  • --no-autocommit: Skip auto-committing workspace changes.
  • --no-autopush: Skip pushing git commits.

Pull files from Dataform

python -m surquest.GCP.dataform_cli pull \
  --project-id=my-gcp-project \
  --region=europe-west1 \
  --repository-id=my-repo \
  --workspace-id=dev \
  --target-dir=./local_workspace

🐳 Using the CLI via Docker

You can run the CLI inside a Docker container, mounting your local source or target directory as a volume, and passing your Google credentials via an environment variable.

docker run --rm -it \
  -v /path/to/local/source:/app/source \
  -e GOOGLE_APPLICATION_CREDENTIALS=/app/creds.json \
  -v /path/to/your/creds.json:/app/creds.json:ro \
  your-docker-image-name \
  python -m surquest.GCP.dataform_cli push \
    --project-id=my-gcp-project \
    --region=europe-west1 \
    --repository-id=my-repo \
    --workspace-id=dev \
    --source-dir=/app/source

Similarly, for pulling files:

docker run --rm -it \
  -v /path/to/local/target:/app/target \
  -e GOOGLE_APPLICATION_CREDENTIALS=/app/creds.json \
  -v /path/to/your/creds.json:/app/creds.json:ro \
  your-docker-image-name \
  python -m surquest.GCP.dataform_cli pull \
    --project-id=my-gcp-project \
    --region=europe-west1 \
    --repository-id=my-repo \
    --workspace-id=dev \
    --target-dir=/app/target

Notes:

  • Replace /path/to/local/source and /path/to/local/target with your actual local paths.
  • The service account key JSON file is mounted inside the container at /app/creds.json.
  • The GOOGLE_APPLICATION_CREDENTIALS environment variable points to this file for authentication.
  • your-docker-image-name should be replaced with your built Docker image tag.

🛠 Requirements

  • Python 3.8+
  • google-cloud-dataform
  • Service account or user credentials with access to the Dataform API.

📬 Contact & Support

For issues, improvements, or collaboration, please contact:

Michal Švarc ✉️ [michal.svarc@surquest.com] 📞 +420 724 031 631

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

surquest_gcp_dataform_cli-0.0.1rc1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

surquest_gcp_dataform_cli-0.0.1rc1-py2.py3-none-any.whl (13.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file surquest_gcp_dataform_cli-0.0.1rc1.tar.gz.

File metadata

File hashes

Hashes for surquest_gcp_dataform_cli-0.0.1rc1.tar.gz
Algorithm Hash digest
SHA256 597899349c46a330968d37e3def36aa2158f8d2be9e15ed9a89e8f8530f51493
MD5 7139b6f2b339d13d97062fb456830d28
BLAKE2b-256 516f235f04aad887f11e57b69acc3da20b296a4bc51e3fc226348c6030b997b3

See more details on using hashes here.

File details

Details for the file surquest_gcp_dataform_cli-0.0.1rc1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for surquest_gcp_dataform_cli-0.0.1rc1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f880ba076a2ab648251fc42c533fc17e52af2a31074362db86c20ce0db4b1c15
MD5 77167ca0ad4b54a9cd6e692aef6540f9
BLAKE2b-256 71c0d38a8e9b5f38784c31d258d584e7d1d637e29e50d3b126bcc75883af16b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page