Metadata-Version: 2.5
Name: dq-export-connector
Version: 0.1.0.dev26
Summary: Worker logic for the Export Connector DCR.
Author: Decentriq
Requires-Python: >=3.12
Requires-Dist: pydantic<3,>=2.14
Provides-Extra: bucket
Requires-Dist: obstore<0.12,>=0.11.1; extra == 'bucket'
Description-Content-Type: text/markdown

# dq-export-connector

Worker logic for the **Export Connector DCR**: one package for every
Connector Kind, each in its own sub-package with an extra of the same name for
its dependencies. The **bucket** kind uploads each Input's dataset to S3, Azure
Blob or GCS through [`obstore`](https://developmentseed.org/obstore/).

ddc pins this package by hash in a fully locked `requirements.txt` and runs
`dq_export_connector.runner.main` in the task's Python environment. It is
published to PyPI, since the compiled graph installs it from there.

- `dq_export_connector.runner`: the entry point. Reads `/input/config.json`
  and `/input/credentials.json`, sets up logging, and dispatches on the
  Connector Kind and the action, then writes what the action reports: a
  connection test's result into `/output`, and an export's receipt and either
  action's warnings and error under `/internal`, as the task's Task Report,
  Application Warnings and Application Error. A run with an error fails.
- `dq_export_connector.errors`: the error and warning codes the worker
  reports, and `ExportConnectorError`, which stops a run with an error code.
- `dq_export_connector.outcome`: collects a run's error, warnings and receipt
  while it runs, and cuts each message to 1,000 characters, and a provider's
  own error to 4,000, once redacted.
- `dq_export_connector.redact`: keeps every value from the sealed half, and
  URL query strings, out of log lines and result messages.
- `dq_export_connector.bucket`: the bucket kind (`ValidateConnection` and
  `Export`).
- `dq_export_connector.models`: the types the worker reads and writes, those
  of every Connector Kind directly in it and a kind's own in its submodule,
  such as `models.bucket`. They are pydantic models generated in
  `dq_export_connector._models` from ddc's JSON schemas, so the config the
  worker reads and the receipt, messages and validation result it writes match
  ddc's Rust types. Regenerate them with `scripts/codegen-models.sh` after the
  types change and `decentriq_dcr_compiler` has been rebuilt; a test fails
  while they are stale.

```sh
uv run pytest            # unit tests, against obstore's in-memory store
uv run pytest -m live    # against real buckets, credentials from the environment
uv run mypy dq_export_connector tests
```

## Releasing

Bump the version with `uv version <version> --no-sync`, which also updates
`uv.lock`, commit, and push a `dq-export-connector-v<version>` tag on that
commit; the `Publish dq-export-connector to PyPI` workflow tests, builds and
uploads it. Use `.devN` versions while developing; PyPI releases can't be replaced.
ddc then pins the new version, as
[ddc's export worker README](../../dcr-compiler/ddc/src/archv2/data_room/export_connector/README.md)
describes.
