dq-export-connector 0.1.0.dev35__tar.gz → 0.1.0.dev36__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. dq_export_connector-0.1.0.dev36/.gitignore +63 -0
  2. dq_export_connector-0.1.0.dev36/PKG-INFO +100 -0
  3. dq_export_connector-0.1.0.dev36/README.md +79 -0
  4. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/export_connector_credentials.py +69 -19
  5. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/export_receipt.py +221 -119
  6. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/export_worker_config.py +271 -92
  7. dq_export_connector-0.1.0.dev36/dq_export_connector/adform/export.py +123 -0
  8. dq_export_connector-0.1.0.dev36/dq_export_connector/audience/export.py +75 -0
  9. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/audience/identifiers.py +2 -0
  10. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/audience/sync.py +16 -42
  11. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/bucket/validate.py +5 -1
  12. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/errors.py +34 -21
  13. dq_export_connector-0.1.0.dev36/dq_export_connector/files/export.py +161 -0
  14. dq_export_connector-0.1.0.dev36/dq_export_connector/files/naming.py +30 -0
  15. dq_export_connector-0.1.0.dev36/dq_export_connector/google_ad_manager/export.py +103 -0
  16. dq_export_connector-0.1.0.dev36/dq_export_connector/google_ad_manager/store.py +64 -0
  17. dq_export_connector-0.1.0.dev36/dq_export_connector/google_auth.py +154 -0
  18. dq_export_connector-0.1.0.dev36/dq_export_connector/google_dv360/clients.py +55 -0
  19. dq_export_connector-0.1.0.dev36/dq_export_connector/google_dv360/destination.py +213 -0
  20. dq_export_connector-0.1.0.dev36/dq_export_connector/google_dv360/export.py +83 -0
  21. dq_export_connector-0.1.0.dev36/dq_export_connector/google_dv360/validate.py +82 -0
  22. dq_export_connector-0.1.0.dev36/dq_export_connector/google_oauth.py +7 -0
  23. dq_export_connector-0.1.0.dev36/dq_export_connector/meta/__init__.py +0 -0
  24. dq_export_connector-0.1.0.dev36/dq_export_connector/meta/client.py +292 -0
  25. dq_export_connector-0.1.0.dev36/dq_export_connector/meta/destination.py +216 -0
  26. dq_export_connector-0.1.0.dev36/dq_export_connector/meta/export.py +69 -0
  27. dq_export_connector-0.1.0.dev36/dq_export_connector/meta/validate.py +39 -0
  28. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/models/__init__.py +15 -1
  29. dq_export_connector-0.1.0.dev36/dq_export_connector/models/adform.py +33 -0
  30. dq_export_connector-0.1.0.dev35/dq_export_connector/models/segment.py → dq_export_connector-0.1.0.dev36/dq_export_connector/models/audience.py +3 -3
  31. dq_export_connector-0.1.0.dev36/dq_export_connector/models/google.py +9 -0
  32. dq_export_connector-0.1.0.dev36/dq_export_connector/models/google_ad_manager.py +38 -0
  33. dq_export_connector-0.1.0.dev36/dq_export_connector/models/google_dv360.py +27 -0
  34. dq_export_connector-0.1.0.dev36/dq_export_connector/models/meta.py +35 -0
  35. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/oauth.py +12 -6
  36. dq_export_connector-0.1.0.dev36/dq_export_connector/redact.py +78 -0
  37. dq_export_connector-0.1.0.dev36/dq_export_connector/runner.py +404 -0
  38. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/pyproject.toml +15 -11
  39. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/scripts/codegen-models.sh +3 -1
  40. dq_export_connector-0.1.0.dev36/tests/__init__.py +0 -0
  41. dq_export_connector-0.1.0.dev36/tests/fakes/__init__.py +0 -0
  42. dq_export_connector-0.1.0.dev36/tests/fakes/google_dv360_fake.py +118 -0
  43. dq_export_connector-0.1.0.dev36/tests/fakes/meta_fake.py +143 -0
  44. dq_export_connector-0.1.0.dev36/tests/support.py +105 -0
  45. dq_export_connector-0.1.0.dev36/tests/test_file_kinds_runner.py +278 -0
  46. dq_export_connector-0.1.0.dev36/tests/test_google_dv360_runner.py +301 -0
  47. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_identifiers_and_inputs.py +43 -9
  48. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_live_buckets.py +4 -2
  49. dq_export_connector-0.1.0.dev36/tests/test_live_file_kinds.py +106 -0
  50. dq_export_connector-0.1.0.dev36/tests/test_live_google_dv360.py +93 -0
  51. dq_export_connector-0.1.0.dev36/tests/test_live_meta.py +76 -0
  52. dq_export_connector-0.1.0.dev36/tests/test_meta_runner.py +316 -0
  53. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_oauth.py +3 -12
  54. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_redact.py +1 -16
  55. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_runner.py +2 -0
  56. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_sync_input.py +8 -39
  57. dq_export_connector-0.1.0.dev36/uv.lock +1773 -0
  58. dq_export_connector-0.1.0.dev35/.gitignore +0 -5
  59. dq_export_connector-0.1.0.dev35/PKG-INFO +0 -237
  60. dq_export_connector-0.1.0.dev35/README.md +0 -222
  61. dq_export_connector-0.1.0.dev35/dq_export_connector/audience/classify.py +0 -84
  62. dq_export_connector-0.1.0.dev35/dq_export_connector/audience/http.py +0 -272
  63. dq_export_connector-0.1.0.dev35/dq_export_connector/models/snap.py +0 -43
  64. dq_export_connector-0.1.0.dev35/dq_export_connector/models/tiktok.py +0 -43
  65. dq_export_connector-0.1.0.dev35/dq_export_connector/redact.py +0 -128
  66. dq_export_connector-0.1.0.dev35/dq_export_connector/runner.py +0 -306
  67. dq_export_connector-0.1.0.dev35/dq_export_connector/snap/accounts.py +0 -18
  68. dq_export_connector-0.1.0.dev35/dq_export_connector/snap/client.py +0 -169
  69. dq_export_connector-0.1.0.dev35/dq_export_connector/snap/destination.py +0 -119
  70. dq_export_connector-0.1.0.dev35/dq_export_connector/snap/export.py +0 -127
  71. dq_export_connector-0.1.0.dev35/dq_export_connector/snap/session.py +0 -103
  72. dq_export_connector-0.1.0.dev35/dq_export_connector/snap/validate.py +0 -29
  73. dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok/accounts.py +0 -27
  74. dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok/client.py +0 -251
  75. dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok/destination.py +0 -247
  76. dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok/export.py +0 -128
  77. dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok/session.py +0 -88
  78. dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok/validate.py +0 -38
  79. dq_export_connector-0.1.0.dev35/scripts/_local.py +0 -146
  80. dq_export_connector-0.1.0.dev35/scripts/run_local.py +0 -96
  81. dq_export_connector-0.1.0.dev35/tests/conftest.py +0 -37
  82. dq_export_connector-0.1.0.dev35/tests/fakes/snap_fake.py +0 -285
  83. dq_export_connector-0.1.0.dev35/tests/fakes/tiktok_fake.py +0 -322
  84. dq_export_connector-0.1.0.dev35/tests/test_audience_http.py +0 -104
  85. dq_export_connector-0.1.0.dev35/tests/test_http_and_oauth.py +0 -364
  86. dq_export_connector-0.1.0.dev35/tests/test_live_snap.py +0 -137
  87. dq_export_connector-0.1.0.dev35/tests/test_live_tiktok.py +0 -111
  88. dq_export_connector-0.1.0.dev35/tests/test_scripts.py +0 -22
  89. dq_export_connector-0.1.0.dev35/tests/test_snap_runner.py +0 -659
  90. dq_export_connector-0.1.0.dev35/tests/test_tiktok_runner.py +0 -579
  91. dq_export_connector-0.1.0.dev35/uv.lock +0 -725
  92. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/.python-version +0 -0
  93. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/__init__.py +0 -0
  94. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/__init__.py +0 -0
  95. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/application_error.py +0 -0
  96. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/application_warning.py +0 -0
  97. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/_models/destination_account_listing.py +0 -0
  98. {dq_export_connector-0.1.0.dev35/dq_export_connector/audience → dq_export_connector-0.1.0.dev36/dq_export_connector/adform}/__init__.py +0 -0
  99. {dq_export_connector-0.1.0.dev35/dq_export_connector/bucket → dq_export_connector-0.1.0.dev36/dq_export_connector/audience}/__init__.py +0 -0
  100. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/audience/inputs.py +0 -0
  101. {dq_export_connector-0.1.0.dev35/dq_export_connector/snap → dq_export_connector-0.1.0.dev36/dq_export_connector/bucket}/__init__.py +0 -0
  102. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/bucket/export.py +0 -0
  103. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/bucket/paths.py +0 -0
  104. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/bucket/store.py +0 -0
  105. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/bucket/upload.py +0 -0
  106. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/datasets.py +0 -0
  107. {dq_export_connector-0.1.0.dev35/dq_export_connector/tiktok → dq_export_connector-0.1.0.dev36/dq_export_connector/files}/__init__.py +0 -0
  108. {dq_export_connector-0.1.0.dev35/tests → dq_export_connector-0.1.0.dev36/dq_export_connector/google_ad_manager}/__init__.py +0 -0
  109. {dq_export_connector-0.1.0.dev35/tests/fakes → dq_export_connector-0.1.0.dev36/dq_export_connector/google_dv360}/__init__.py +0 -0
  110. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/log.py +0 -0
  111. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/models/bucket.py +0 -0
  112. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/dq_export_connector/outcome.py +0 -0
  113. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_models_are_current.py +0 -0
  114. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_paths.py +0 -0
  115. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_store.py +0 -0
  116. {dq_export_connector-0.1.0.dev35 → dq_export_connector-0.1.0.dev36}/tests/test_upload.py +0 -0
@@ -0,0 +1,63 @@
1
+ .DS_Store
2
+ **/build/
3
+ .idea/
4
+ .vscode/*
5
+ !.vscode/tasks.json
6
+ target/
7
+ node_modules/
8
+ result
9
+ /result-*
10
+ **/*.o
11
+ env
12
+ venv
13
+ .venv
14
+ .direnv
15
+ **/perf.data*
16
+ infra/packages/hadoop/binary.tar.gz
17
+ .terraform
18
+ config.tf.json
19
+ *.tfstate.*
20
+ *.tfstate
21
+ **/.deploy-gc
22
+ .vagrant
23
+ .pnpm-debug.log
24
+ .yarn
25
+ __pycache__
26
+ trusted/dcr-compiler/ddc/src/data_lab/**/*.png
27
+ trusted/dcr-compiler/ddc/src/data_lab/**/*.json
28
+ e2e-tests/frontend/confidence-check-config.json
29
+ .terraform.lock.hcl
30
+ dmp/analysis-scripts/results/*
31
+ .env
32
+ !tools/dqdev/internal/target/
33
+ docusaurus/style-guide.md
34
+ **/.claude/settings.local.json
35
+ **/.claude/agent-memory-local/
36
+ .claude/*.lock
37
+ .claude/worktrees/
38
+ **/CLAUDE.local.md
39
+ **/*.parquet/**
40
+ .pnpm-store/
41
+ .turbo/
42
+
43
+ # Agentic-coding workflow (local, not part of this repo)
44
+ .workflow/
45
+ .workflow-backup-*
46
+
47
+ # Local-only Google Ads/DV360 test scripts (kept out of the PR)
48
+ dmp/dqdmp/scripts/
49
+
50
+ # Playwright MCP screenshots (local only)
51
+ .playwright-mcp/
52
+
53
+ # Claude Design sync build artifacts (local only).
54
+ **/.design-sync/sb-reference/
55
+ **/.design-sync/learnings/
56
+ **/.design-sync/.cache/
57
+ **/.design-sync/node_modules
58
+ .ds-sync/
59
+ ds-bundle/
60
+
61
+ # DMP creation-prefill tests (local only)
62
+ avato-backend/frontend/decentriq-platform/src/features/dmp/models/creationPrefill.test.ts
63
+ avato-backend/frontend/decentriq-platform/src/features/dmp/utils/creationPrefill/*.test.ts
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.5
2
+ Name: dq-export-connector
3
+ Version: 0.1.0.dev36
4
+ Summary: Worker logic for the Export Connector DCR.
5
+ Author: Decentriq
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: pydantic<3,>=2.14
8
+ Provides-Extra: adform
9
+ Requires-Dist: obstore<0.12,>=0.11.1; extra == 'adform'
10
+ Provides-Extra: bucket
11
+ Requires-Dist: obstore<0.12,>=0.11.1; extra == 'bucket'
12
+ Provides-Extra: google-ad-manager
13
+ Requires-Dist: obstore<0.12,>=0.11.1; extra == 'google-ad-manager'
14
+ Provides-Extra: google-dv360
15
+ Requires-Dist: google-ads-datamanager<0.10,>=0.9.5; extra == 'google-dv360'
16
+ Requires-Dist: google-auth<3,>=2.63; extra == 'google-dv360'
17
+ Requires-Dist: requests<3,>=2.32; extra == 'google-dv360'
18
+ Provides-Extra: meta
19
+ Requires-Dist: facebook-business<28,>=27.0.1; extra == 'meta'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # dq-export-connector
23
+
24
+ Worker logic for the **Export Connector DCR**: one package for every
25
+ Connector Kind, each in its own sub-package with an extra of the same name for
26
+ its dependencies:
27
+
28
+ | Kind | Extra | What a run does | Through |
29
+ | --- | --- | --- | --- |
30
+ | Bucket | `bucket` | Uploads each Input's dataset to S3, Azure Blob or GCS | [`obstore`](https://developmentseed.org/obstore/) |
31
+ | Meta | `meta` | Fills a customer list custom audience per Input | Meta's [`facebook-business`](https://github.com/facebook/facebook-python-business-sdk) SDK |
32
+ | Google DV360 | `google-dv360` | Fills a Customer Match user list per Input | Google's [`google-ads-datamanager`](https://github.com/googleads/data-manager-python) client |
33
+ | Google Ad Manager | `google-ad-manager` | Writes a batch upload file per Input to the network's GCS bucket | `obstore` |
34
+ | Adform | `adform` | Writes an identifier file per Input to Adform's S3 bucket | `obstore` |
35
+
36
+ ddc pins this package by hash in a fully locked `requirements.txt` and runs
37
+ `dq_export_connector.runner.main` in the task's Python environment. It is
38
+ published to PyPI, since the compiled graph installs it from there.
39
+
40
+ - `dq_export_connector.runner`: the entry point. Reads `/input/config.json`
41
+ and `/input/credentials.json`, sets up logging, and dispatches on the
42
+ Connector Kind and the action, then writes what the action reports under
43
+ `/internal`: an export's receipt, and either action's warnings and error, as
44
+ the task's Task Report, Application Warnings and Application Error. An action
45
+ with an error also writes it as `/internal/safe_error`, `CODE: message`,
46
+ which the container worker shows as the task's `error`, and exits with 1.
47
+ - `dq_export_connector.errors`: the error and warning codes the worker
48
+ reports, `ExportConnectorError`, which stops an action with an error code,
49
+ and `ExportConnectorWarning`. Each becomes an Application Error or Warning
50
+ with its credentials masked, its message cut to 1,000 characters and a
51
+ provider's own error to 4,000.
52
+ - `dq_export_connector.outcome`: collects a run's error, warnings and receipt
53
+ while it runs.
54
+ - `dq_export_connector.redact`: keeps every value from the sealed half, and
55
+ URL query strings, out of log lines and result messages.
56
+ - `dq_export_connector.bucket`: the bucket kind (`ValidateConnection` and
57
+ `Export`).
58
+ - `dq_export_connector.audience`: what the kinds that fill Segments share.
59
+ An Input is one value per line, which `identifiers` and `inputs` normalise,
60
+ hash where the platform takes hashes, and count when invalid. `sync` runs
61
+ an Input into its Segment through a kind's `AudienceDestination`: find the
62
+ Segment by name or create it, stage the values in batches, commit. `export`
63
+ loops over the Inputs and keeps the receipt.
64
+ - `dq_export_connector.meta` and `dq_export_connector.google_dv360`: the two
65
+ Segment kinds, each an `AudienceDestination` over its provider's library,
66
+ with a `ValidateConnection` that checks the connector's Destination Account
67
+ or lists the accounts the credentials reach.
68
+ - `dq_export_connector.files`: what the kinds that upload identifier files
69
+ share: the file's name, its rows and its upload.
70
+ - `dq_export_connector.google_ad_manager` and `dq_export_connector.adform`:
71
+ the two file kinds, which format an Input's rows and name its object.
72
+ - `dq_export_connector.oauth`, `google_auth` and `google_oauth`: Access Tokens
73
+ from an OAuth Grant, and Google credentials from either Credential Scheme.
74
+ - `dq_export_connector.models`: the types the worker reads and writes, those
75
+ of every Connector Kind directly in it and a kind's own in its submodule,
76
+ such as `models.bucket`. They are pydantic models generated in
77
+ `dq_export_connector._models` from ddc's JSON schemas, so the config the
78
+ worker reads and the receipt, warnings and errors it writes match
79
+ ddc's Rust types. Regenerate them with `scripts/codegen-models.sh` after the
80
+ types change and `decentriq_dcr_compiler` has been rebuilt; a test fails
81
+ while they are stale.
82
+
83
+ ```sh
84
+ uv run pytest # unit tests, against obstore's in-memory store and fakes of the providers' APIs
85
+ uv run pytest -m live # against real buckets and accounts, credentials from the environment
86
+ uv run mypy dq_export_connector tests
87
+ ```
88
+
89
+ A live test skips when its credentials are missing; each test file's
90
+ docstring names the variables it reads.
91
+
92
+ ## Releasing
93
+
94
+ Bump the version with `uv version <version> --no-sync`, which also updates
95
+ `uv.lock`, commit, and push a `dq-export-connector-v<version>` tag on that
96
+ commit; the `Publish dq-export-connector to PyPI` workflow tests, builds and
97
+ uploads it. Use `.devN` versions while developing; PyPI releases can't be replaced.
98
+ ddc then pins the new version, as
99
+ [ddc's export worker README](../../dcr-compiler/ddc/src/archv2/data_room/export_connector/README.md)
100
+ describes.
@@ -0,0 +1,79 @@
1
+ # dq-export-connector
2
+
3
+ Worker logic for the **Export Connector DCR**: one package for every
4
+ Connector Kind, each in its own sub-package with an extra of the same name for
5
+ its dependencies:
6
+
7
+ | Kind | Extra | What a run does | Through |
8
+ | --- | --- | --- | --- |
9
+ | Bucket | `bucket` | Uploads each Input's dataset to S3, Azure Blob or GCS | [`obstore`](https://developmentseed.org/obstore/) |
10
+ | Meta | `meta` | Fills a customer list custom audience per Input | Meta's [`facebook-business`](https://github.com/facebook/facebook-python-business-sdk) SDK |
11
+ | Google DV360 | `google-dv360` | Fills a Customer Match user list per Input | Google's [`google-ads-datamanager`](https://github.com/googleads/data-manager-python) client |
12
+ | Google Ad Manager | `google-ad-manager` | Writes a batch upload file per Input to the network's GCS bucket | `obstore` |
13
+ | Adform | `adform` | Writes an identifier file per Input to Adform's S3 bucket | `obstore` |
14
+
15
+ ddc pins this package by hash in a fully locked `requirements.txt` and runs
16
+ `dq_export_connector.runner.main` in the task's Python environment. It is
17
+ published to PyPI, since the compiled graph installs it from there.
18
+
19
+ - `dq_export_connector.runner`: the entry point. Reads `/input/config.json`
20
+ and `/input/credentials.json`, sets up logging, and dispatches on the
21
+ Connector Kind and the action, then writes what the action reports under
22
+ `/internal`: an export's receipt, and either action's warnings and error, as
23
+ the task's Task Report, Application Warnings and Application Error. An action
24
+ with an error also writes it as `/internal/safe_error`, `CODE: message`,
25
+ which the container worker shows as the task's `error`, and exits with 1.
26
+ - `dq_export_connector.errors`: the error and warning codes the worker
27
+ reports, `ExportConnectorError`, which stops an action with an error code,
28
+ and `ExportConnectorWarning`. Each becomes an Application Error or Warning
29
+ with its credentials masked, its message cut to 1,000 characters and a
30
+ provider's own error to 4,000.
31
+ - `dq_export_connector.outcome`: collects a run's error, warnings and receipt
32
+ while it runs.
33
+ - `dq_export_connector.redact`: keeps every value from the sealed half, and
34
+ URL query strings, out of log lines and result messages.
35
+ - `dq_export_connector.bucket`: the bucket kind (`ValidateConnection` and
36
+ `Export`).
37
+ - `dq_export_connector.audience`: what the kinds that fill Segments share.
38
+ An Input is one value per line, which `identifiers` and `inputs` normalise,
39
+ hash where the platform takes hashes, and count when invalid. `sync` runs
40
+ an Input into its Segment through a kind's `AudienceDestination`: find the
41
+ Segment by name or create it, stage the values in batches, commit. `export`
42
+ loops over the Inputs and keeps the receipt.
43
+ - `dq_export_connector.meta` and `dq_export_connector.google_dv360`: the two
44
+ Segment kinds, each an `AudienceDestination` over its provider's library,
45
+ with a `ValidateConnection` that checks the connector's Destination Account
46
+ or lists the accounts the credentials reach.
47
+ - `dq_export_connector.files`: what the kinds that upload identifier files
48
+ share: the file's name, its rows and its upload.
49
+ - `dq_export_connector.google_ad_manager` and `dq_export_connector.adform`:
50
+ the two file kinds, which format an Input's rows and name its object.
51
+ - `dq_export_connector.oauth`, `google_auth` and `google_oauth`: Access Tokens
52
+ from an OAuth Grant, and Google credentials from either Credential Scheme.
53
+ - `dq_export_connector.models`: the types the worker reads and writes, those
54
+ of every Connector Kind directly in it and a kind's own in its submodule,
55
+ such as `models.bucket`. They are pydantic models generated in
56
+ `dq_export_connector._models` from ddc's JSON schemas, so the config the
57
+ worker reads and the receipt, warnings and errors it writes match
58
+ ddc's Rust types. Regenerate them with `scripts/codegen-models.sh` after the
59
+ types change and `decentriq_dcr_compiler` has been rebuilt; a test fails
60
+ while they are stale.
61
+
62
+ ```sh
63
+ uv run pytest # unit tests, against obstore's in-memory store and fakes of the providers' APIs
64
+ uv run pytest -m live # against real buckets and accounts, credentials from the environment
65
+ uv run mypy dq_export_connector tests
66
+ ```
67
+
68
+ A live test skips when its credentials are missing; each test file's
69
+ docstring names the variables it reads.
70
+
71
+ ## Releasing
72
+
73
+ Bump the version with `uv version <version> --no-sync`, which also updates
74
+ `uv.lock`, commit, and push a `dq-export-connector-v<version>` tag on that
75
+ commit; the `Publish dq-export-connector to PyPI` workflow tests, builds and
76
+ uploads it. Use `.devN` versions while developing; PyPI releases can't be replaced.
77
+ ddc then pins the new version, as
78
+ [ddc's export worker README](../../dcr-compiler/ddc/src/archv2/data_room/export_connector/README.md)
79
+ describes.
@@ -8,6 +8,14 @@ from typing import Annotated, Literal
8
8
  from pydantic import BaseModel, ConfigDict, Field, RootModel
9
9
 
10
10
 
11
+ class AdformExportCredentials(BaseModel):
12
+ model_config = ConfigDict(
13
+ populate_by_name=True,
14
+ )
15
+ access_key: Annotated[str, Field(alias='accessKey')]
16
+ secret_key: Annotated[str, Field(alias='secretKey')]
17
+
18
+
11
19
  class BucketExportCredentialsS3(BaseModel):
12
20
  model_config = ConfigDict(
13
21
  populate_by_name=True,
@@ -56,6 +64,14 @@ class BucketExportCredentials(
56
64
  ]
57
65
 
58
66
 
67
+ class GoogleSealedCredentialsServiceAccount(BaseModel):
68
+ model_config = ConfigDict(
69
+ populate_by_name=True,
70
+ )
71
+ service_account_json: Annotated[str, Field(alias='serviceAccountJson')]
72
+ type: Literal['serviceAccount']
73
+
74
+
59
75
  class GrantTokenRefreshToken(BaseModel):
60
76
  model_config = ConfigDict(
61
77
  populate_by_name=True,
@@ -76,6 +92,14 @@ class GrantToken(RootModel[GrantTokenRefreshToken | GrantTokenAccessToken]):
76
92
  root: GrantTokenRefreshToken | GrantTokenAccessToken
77
93
 
78
94
 
95
+ class MetaSealedCredentialsAccessToken(BaseModel):
96
+ model_config = ConfigDict(
97
+ populate_by_name=True,
98
+ )
99
+ access_token: Annotated[str, Field(alias='accessToken')]
100
+ type: Literal['accessToken']
101
+
102
+
79
103
  class OAuthGrant(BaseModel):
80
104
  model_config = ConfigDict(
81
105
  populate_by_name=True,
@@ -93,7 +117,23 @@ class OAuthGrant(BaseModel):
93
117
  token: GrantToken
94
118
 
95
119
 
96
- class SnapExportCredentialsOauth(BaseModel):
120
+ class ExportConnectorCredentialsBucket(BaseModel):
121
+ model_config = ConfigDict(
122
+ populate_by_name=True,
123
+ )
124
+ credentials: BucketExportCredentials
125
+ type: Literal['bucket']
126
+
127
+
128
+ class ExportConnectorCredentialsAdform(BaseModel):
129
+ model_config = ConfigDict(
130
+ populate_by_name=True,
131
+ )
132
+ credentials: AdformExportCredentials
133
+ type: Literal['adform']
134
+
135
+
136
+ class GoogleSealedCredentialsOauth(BaseModel):
97
137
  model_config = ConfigDict(
98
138
  populate_by_name=True,
99
139
  )
@@ -101,13 +141,16 @@ class SnapExportCredentialsOauth(BaseModel):
101
141
  type: Literal['oauth']
102
142
 
103
143
 
104
- class SnapExportCredentials(RootModel[SnapExportCredentialsOauth]):
144
+ class GoogleSealedCredentials(
145
+ RootModel[GoogleSealedCredentialsServiceAccount | GoogleSealedCredentialsOauth]
146
+ ):
105
147
  root: Annotated[
106
- SnapExportCredentialsOauth, Field(description='What is sealed for Snap.')
148
+ GoogleSealedCredentialsServiceAccount | GoogleSealedCredentialsOauth,
149
+ Field(description='What is sealed, tagged like what was sent.'),
107
150
  ]
108
151
 
109
152
 
110
- class TiktokExportCredentialsOauth(BaseModel):
153
+ class MetaSealedCredentialsOauth(BaseModel):
111
154
  model_config = ConfigDict(
112
155
  populate_by_name=True,
113
156
  )
@@ -115,47 +158,54 @@ class TiktokExportCredentialsOauth(BaseModel):
115
158
  type: Literal['oauth']
116
159
 
117
160
 
118
- class TiktokExportCredentials(RootModel[TiktokExportCredentialsOauth]):
161
+ class MetaSealedCredentials(
162
+ RootModel[MetaSealedCredentialsAccessToken | MetaSealedCredentialsOauth]
163
+ ):
119
164
  root: Annotated[
120
- TiktokExportCredentialsOauth, Field(description='What is sealed for TikTok.')
165
+ MetaSealedCredentialsAccessToken | MetaSealedCredentialsOauth,
166
+ Field(description='What is sealed, tagged like what was sent.'),
121
167
  ]
122
168
 
123
169
 
124
- class ExportConnectorCredentialsBucket(BaseModel):
170
+ class ExportConnectorCredentialsMeta(BaseModel):
125
171
  model_config = ConfigDict(
126
172
  populate_by_name=True,
127
173
  )
128
- credentials: BucketExportCredentials
129
- type: Literal['bucket']
174
+ credentials: MetaSealedCredentials
175
+ type: Literal['meta']
130
176
 
131
177
 
132
- class ExportConnectorCredentialsSnap(BaseModel):
178
+ class ExportConnectorCredentialsGoogleDv360(BaseModel):
133
179
  model_config = ConfigDict(
134
180
  populate_by_name=True,
135
181
  )
136
- credentials: SnapExportCredentials
137
- type: Literal['snap']
182
+ credentials: GoogleSealedCredentials
183
+ type: Literal['googleDv360']
138
184
 
139
185
 
140
- class ExportConnectorCredentialsTiktok(BaseModel):
186
+ class ExportConnectorCredentialsGoogleAdManager(BaseModel):
141
187
  model_config = ConfigDict(
142
188
  populate_by_name=True,
143
189
  )
144
- credentials: TiktokExportCredentials
145
- type: Literal['tiktok']
190
+ credentials: GoogleSealedCredentials
191
+ type: Literal['googleAdManager']
146
192
 
147
193
 
148
194
  class ExportConnectorCredentials(
149
195
  RootModel[
150
196
  ExportConnectorCredentialsBucket
151
- | ExportConnectorCredentialsSnap
152
- | ExportConnectorCredentialsTiktok
197
+ | ExportConnectorCredentialsMeta
198
+ | ExportConnectorCredentialsGoogleDv360
199
+ | ExportConnectorCredentialsGoogleAdManager
200
+ | ExportConnectorCredentialsAdform
153
201
  ]
154
202
  ):
155
203
  root: Annotated[
156
204
  ExportConnectorCredentialsBucket
157
- | ExportConnectorCredentialsSnap
158
- | ExportConnectorCredentialsTiktok,
205
+ | ExportConnectorCredentialsMeta
206
+ | ExportConnectorCredentialsGoogleDv360
207
+ | ExportConnectorCredentialsGoogleAdManager
208
+ | ExportConnectorCredentialsAdform,
159
209
  Field(
160
210
  description='Keyed by Connector Kind, in step with [`ExportConnectorKind`]. The worker\nreads it at `/input/credentials.json`.',
161
211
  title='ExportConnectorCredentials',