Metadata-Version: 2.4
Name: surquest-GCP-dataform-cli
Version: 0.0.1rc2
Summary: `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-URL: Homepage, https://github.com/surquest/python-dataform-cli
Project-URL: Bug Tracker, https://github.com/surquest/python-dataform-cli/issues
Author-email: Michal Švarc <michal.svarc@surquest.com>
License-File: LICENSE
Requires-Dist: google-cloud-dataform>=0.6.0
Requires-Dist: pathspec>=0.12.0
Provides-Extra: test
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
Requires-Dist: pytest>=7.2.1; extra == 'test'
Description-Content-Type: text/markdown

# 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

```bash
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

```bash
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.

```bash
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:

```bash
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](mailto:michal.svarc@surquest.com)]
📞 +420 724 031 631
