Metadata-Version: 2.5
Name: dlt-source-google-workspace
Version: 0.0.7
Summary: DLT (dlthub.com) source for Google Workspace
Author: Planet A Ventures
Maintainer-email: Joscha Feth <joscha@planet-a.com>
License: MIT
License-File: LICENSE
Keywords: calendar,dlt,dlthub,google,workspace
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.12
Requires-Dist: dlt>=1.9.0
Requires-Dist: google-api-python-client>=2.165.0
Requires-Dist: google-auth-oauthlib>=1.2.1
Provides-Extra: show
Requires-Dist: dlt[duckdb]>=1.9.0; extra == 'show'
Requires-Dist: streamlit>=1.41.1; extra == 'show'
Requires-Dist: watchdog>=6.0.0; extra == 'show'
Description-Content-Type: text/markdown

# dlt-source-google-workspace

[![PyPI version](https://img.shields.io/pypi/v/dlt-source-google-workspace)](https://pypi.org/project/dlt-source-google-workspace/)

[DLT](https://dlthub.com/) source for Google Workspace.

Currently loads the following data:

| Table | Contains |
| -- | -- |
| `users` | All users in the organization |
| `calendar_events` | Primary-calendar events per active root-OU user |
| `gmail_messages` | Gmail messages with a configured label, per fixed mailbox |

## Usage

Create a `.dlt/secrets.toml` with your API credentials (`service_account`):

```toml
google_workspace_service_account_info = "{ ... }"
```

and a `.dlt/config.toml` with your admin email address:

```toml
admin_user_email = "some-admin@your-domain.com"
```

`gmail_messages` additionally requires two config values — a fixed mailbox
list (NOT every domain user) and the label name(s) to scope the sync to:

```toml
gmail_mailboxes = ["someone@your-domain.com", "someone-else@your-domain.com"]
gmail_label_names = ["Some Label"]
```

or the equivalent env vars, `GMAIL_MAILBOXES` / `GMAIL_LABEL_NAMES`, each a
JSON array string — e.g. `GMAIL_MAILBOXES='["someone@your-domain.com"]'`. The
domain-wide-delegation service account needs the
`https://www.googleapis.com/auth/gmail.readonly` scope authorized in the
Workspace Admin console (Security -> API controls -> Domain-wide delegation)
alongside the existing Calendar/Directory scopes — this is a manual step, not
something this package can do for you.

and then run the default source with optional list references:

```py
from dlt_source_google_workspace import source as google_workspace_source

pipeline = dlt.pipeline(
   pipeline_name="google_workspace_pipeline",
   destination="duckdb",
   dev_mode=True,
)
google_workspace_data = google_workspace_source()
pipeline.run(google_workspace_data)
```

## Development

This project is using [devenv](https://devenv.sh/).

Commands:

| Command | What does it do? |
| -- | -- |
| `format` | Formats & lints all code |
| `sample-pipeline-run` | Runs the sample pipeline. |
| `sample-pipeline-show` | Starts the streamlit-based dlt hub |
