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.1rc2.tar.gz (13.5 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.1rc2-py2.py3-none-any.whl (14.2 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

File hashes

Hashes for surquest_gcp_dataform_cli-0.0.1rc2.tar.gz
Algorithm Hash digest
SHA256 fd5faadeee48054398e995ec4f446e613c49d8ed57307ae43cc05bdc1f388cd6
MD5 366fa5eac791d3e745f2c581defca6bf
BLAKE2b-256 d03ff8ef7002f7490030eab4a7163158cd7d8ea8a684d23b8dd4addf52b71efa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for surquest_gcp_dataform_cli-0.0.1rc2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d1e31b84361cf9bf5dca4c4dd652e36aa3eda51c3c91e9cc91e213358ecfc078
MD5 22c3269cc831fa7a6d1337563b9a5d8a
BLAKE2b-256 429112488f6ea13641a47af24119a5cd5c5cf86b5520d164bda3c7731691e2ef

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