dq-export-connector 0.1.0.dev28__tar.gz → 0.1.0.dev30__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 (72) hide show
  1. dq_export_connector-0.1.0.dev30/.gitignore +63 -0
  2. dq_export_connector-0.1.0.dev30/PKG-INFO +64 -0
  3. dq_export_connector-0.1.0.dev30/README.md +53 -0
  4. dq_export_connector-0.1.0.dev28/dq_export_connector/_models/application_message.py → dq_export_connector-0.1.0.dev30/dq_export_connector/_models/application_error.py +2 -2
  5. dq_export_connector-0.1.0.dev28/dq_export_connector/_models/snap_validation_result.py → dq_export_connector-0.1.0.dev30/dq_export_connector/_models/application_warning.py +3 -11
  6. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/_models/export_connector_credentials.py +2 -63
  7. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/_models/export_receipt.py +4 -127
  8. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/_models/export_worker_config.py +10 -128
  9. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/bucket/export.py +1 -1
  10. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/bucket/validate.py +2 -2
  11. dq_export_connector-0.1.0.dev30/dq_export_connector/errors.py +99 -0
  12. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/log.py +13 -4
  13. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/models/__init__.py +4 -9
  14. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/models/bucket.py +0 -2
  15. dq_export_connector-0.1.0.dev30/dq_export_connector/outcome.py +44 -0
  16. dq_export_connector-0.1.0.dev30/dq_export_connector/redact.py +69 -0
  17. dq_export_connector-0.1.0.dev30/dq_export_connector/runner.py +160 -0
  18. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/pyproject.toml +8 -11
  19. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/scripts/codegen-models.sh +2 -2
  20. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/tests/test_live_buckets.py +8 -6
  21. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/tests/test_redact.py +0 -5
  22. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/tests/test_runner.py +79 -57
  23. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/uv.lock +238 -184
  24. dq_export_connector-0.1.0.dev28/.gitignore +0 -5
  25. dq_export_connector-0.1.0.dev28/PKG-INFO +0 -153
  26. dq_export_connector-0.1.0.dev28/README.md +0 -140
  27. dq_export_connector-0.1.0.dev28/dq_export_connector/_models/bucket_validation_result.py +0 -37
  28. dq_export_connector-0.1.0.dev28/dq_export_connector/_models/destination_accounts.py +0 -25
  29. dq_export_connector-0.1.0.dev28/dq_export_connector/audience/classify.py +0 -81
  30. dq_export_connector-0.1.0.dev28/dq_export_connector/audience/http.py +0 -237
  31. dq_export_connector-0.1.0.dev28/dq_export_connector/audience/identifiers.py +0 -121
  32. dq_export_connector-0.1.0.dev28/dq_export_connector/audience/inputs.py +0 -80
  33. dq_export_connector-0.1.0.dev28/dq_export_connector/audience/sync.py +0 -313
  34. dq_export_connector-0.1.0.dev28/dq_export_connector/bucket/__init__.py +0 -0
  35. dq_export_connector-0.1.0.dev28/dq_export_connector/errors.py +0 -98
  36. dq_export_connector-0.1.0.dev28/dq_export_connector/models/snap.py +0 -50
  37. dq_export_connector-0.1.0.dev28/dq_export_connector/oauth.py +0 -229
  38. dq_export_connector-0.1.0.dev28/dq_export_connector/outcome.py +0 -58
  39. dq_export_connector-0.1.0.dev28/dq_export_connector/redact.py +0 -123
  40. dq_export_connector-0.1.0.dev28/dq_export_connector/runner.py +0 -280
  41. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/__init__.py +0 -0
  42. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/accounts.py +0 -18
  43. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/client.py +0 -169
  44. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/destination.py +0 -118
  45. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/export.py +0 -127
  46. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/session.py +0 -103
  47. dq_export_connector-0.1.0.dev28/dq_export_connector/snap/validate.py +0 -29
  48. dq_export_connector-0.1.0.dev28/scripts/_local.py +0 -121
  49. dq_export_connector-0.1.0.dev28/scripts/run_local.py +0 -54
  50. dq_export_connector-0.1.0.dev28/tests/__init__.py +0 -0
  51. dq_export_connector-0.1.0.dev28/tests/conftest.py +0 -37
  52. dq_export_connector-0.1.0.dev28/tests/fakes/__init__.py +0 -0
  53. dq_export_connector-0.1.0.dev28/tests/fakes/snap_fake.py +0 -285
  54. dq_export_connector-0.1.0.dev28/tests/test_http_and_oauth.py +0 -359
  55. dq_export_connector-0.1.0.dev28/tests/test_identifiers_and_inputs.py +0 -118
  56. dq_export_connector-0.1.0.dev28/tests/test_live_snap.py +0 -137
  57. dq_export_connector-0.1.0.dev28/tests/test_oauth.py +0 -185
  58. dq_export_connector-0.1.0.dev28/tests/test_scripts.py +0 -22
  59. dq_export_connector-0.1.0.dev28/tests/test_snap_runner.py +0 -648
  60. dq_export_connector-0.1.0.dev28/tests/test_sync_input.py +0 -171
  61. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/.python-version +0 -0
  62. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/__init__.py +0 -0
  63. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/_models/__init__.py +0 -0
  64. {dq_export_connector-0.1.0.dev28/dq_export_connector/audience → dq_export_connector-0.1.0.dev30/dq_export_connector/bucket}/__init__.py +0 -0
  65. {dq_export_connector-0.1.0.dev28/dq_export_connector → dq_export_connector-0.1.0.dev30/dq_export_connector/bucket}/datasets.py +0 -0
  66. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/bucket/paths.py +0 -0
  67. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/bucket/store.py +0 -0
  68. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/dq_export_connector/bucket/upload.py +0 -0
  69. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/tests/test_models_are_current.py +0 -0
  70. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/tests/test_paths.py +0 -0
  71. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/tests/test_store.py +0 -0
  72. {dq_export_connector-0.1.0.dev28 → dq_export_connector-0.1.0.dev30}/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,64 @@
1
+ Metadata-Version: 2.5
2
+ Name: dq-export-connector
3
+ Version: 0.1.0.dev30
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: bucket
9
+ Requires-Dist: obstore<0.12,>=0.11.1; extra == 'bucket'
10
+ Description-Content-Type: text/markdown
11
+
12
+ # dq-export-connector
13
+
14
+ Worker logic for the **Export Connector DCR**: one package for every
15
+ Connector Kind, each in its own sub-package with an extra of the same name for
16
+ its dependencies. The **bucket** kind uploads each Input's dataset to S3, Azure
17
+ Blob or GCS through [`obstore`](https://developmentseed.org/obstore/).
18
+
19
+ ddc pins this package by hash in a fully locked `requirements.txt` and runs
20
+ `dq_export_connector.runner.main` in the task's Python environment. It is
21
+ published to PyPI, since the compiled graph installs it from there.
22
+
23
+ - `dq_export_connector.runner`: the entry point. Reads `/input/config.json`
24
+ and `/input/credentials.json`, sets up logging, and dispatches on the
25
+ Connector Kind and the action, then writes what the action reports under
26
+ `/internal`: an export's receipt, and either action's warnings and error, as
27
+ the task's Task Report, Application Warnings and Application Error. An action
28
+ with an error fails the task with it.
29
+ - `dq_export_connector.errors`: the error and warning codes the worker
30
+ reports, `ExportConnectorError`, which stops an action with an error code,
31
+ and `RedactedExportConnectorError`, the `decentriq_util` `SafeError` that
32
+ fails the task, so the container worker's `error` result ends with
33
+ `CODE: message`. Messages are cut to 1,000 characters, and a provider's own
34
+ error to 4,000, once redacted.
35
+ - `dq_export_connector.outcome`: collects a run's error, warnings and receipt
36
+ while it runs.
37
+ - `dq_export_connector.redact`: keeps every value from the sealed half, and
38
+ URL query strings, out of log lines and result messages.
39
+ - `dq_export_connector.bucket`: the bucket kind (`ValidateConnection` and
40
+ `Export`).
41
+ - `dq_export_connector.models`: the types the worker reads and writes, those
42
+ of every Connector Kind directly in it and a kind's own in its submodule,
43
+ such as `models.bucket`. They are pydantic models generated in
44
+ `dq_export_connector._models` from ddc's JSON schemas, so the config the
45
+ worker reads and the receipt, warnings and errors it writes match
46
+ ddc's Rust types. Regenerate them with `scripts/codegen-models.sh` after the
47
+ types change and `decentriq_dcr_compiler` has been rebuilt; a test fails
48
+ while they are stale.
49
+
50
+ ```sh
51
+ uv run pytest # unit tests, against obstore's in-memory store
52
+ uv run pytest -m live # against real buckets, credentials from the environment
53
+ uv run mypy dq_export_connector tests
54
+ ```
55
+
56
+ ## Releasing
57
+
58
+ Bump the version with `uv version <version> --no-sync`, which also updates
59
+ `uv.lock`, commit, and push a `dq-export-connector-v<version>` tag on that
60
+ commit; the `Publish dq-export-connector to PyPI` workflow tests, builds and
61
+ uploads it. Use `.devN` versions while developing; PyPI releases can't be replaced.
62
+ ddc then pins the new version, as
63
+ [ddc's export worker README](../../dcr-compiler/ddc/src/archv2/data_room/export_connector/README.md)
64
+ describes.
@@ -0,0 +1,53 @@
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. The **bucket** kind uploads each Input's dataset to S3, Azure
6
+ Blob or GCS through [`obstore`](https://developmentseed.org/obstore/).
7
+
8
+ ddc pins this package by hash in a fully locked `requirements.txt` and runs
9
+ `dq_export_connector.runner.main` in the task's Python environment. It is
10
+ published to PyPI, since the compiled graph installs it from there.
11
+
12
+ - `dq_export_connector.runner`: the entry point. Reads `/input/config.json`
13
+ and `/input/credentials.json`, sets up logging, and dispatches on the
14
+ Connector Kind and the action, then writes what the action reports under
15
+ `/internal`: an export's receipt, and either action's warnings and error, as
16
+ the task's Task Report, Application Warnings and Application Error. An action
17
+ with an error fails the task with it.
18
+ - `dq_export_connector.errors`: the error and warning codes the worker
19
+ reports, `ExportConnectorError`, which stops an action with an error code,
20
+ and `RedactedExportConnectorError`, the `decentriq_util` `SafeError` that
21
+ fails the task, so the container worker's `error` result ends with
22
+ `CODE: message`. Messages are cut to 1,000 characters, and a provider's own
23
+ error to 4,000, once redacted.
24
+ - `dq_export_connector.outcome`: collects a run's error, warnings and receipt
25
+ while it runs.
26
+ - `dq_export_connector.redact`: keeps every value from the sealed half, and
27
+ URL query strings, out of log lines and result messages.
28
+ - `dq_export_connector.bucket`: the bucket kind (`ValidateConnection` and
29
+ `Export`).
30
+ - `dq_export_connector.models`: the types the worker reads and writes, those
31
+ of every Connector Kind directly in it and a kind's own in its submodule,
32
+ such as `models.bucket`. They are pydantic models generated in
33
+ `dq_export_connector._models` from ddc's JSON schemas, so the config the
34
+ worker reads and the receipt, warnings and errors it writes match
35
+ ddc's Rust types. Regenerate them with `scripts/codegen-models.sh` after the
36
+ types change and `decentriq_dcr_compiler` has been rebuilt; a test fails
37
+ while they are stale.
38
+
39
+ ```sh
40
+ uv run pytest # unit tests, against obstore's in-memory store
41
+ uv run pytest -m live # against real buckets, credentials from the environment
42
+ uv run mypy dq_export_connector tests
43
+ ```
44
+
45
+ ## Releasing
46
+
47
+ Bump the version with `uv version <version> --no-sync`, which also updates
48
+ `uv.lock`, commit, and push a `dq-export-connector-v<version>` tag on that
49
+ commit; the `Publish dq-export-connector to PyPI` workflow tests, builds and
50
+ uploads it. Use `.devN` versions while developing; PyPI releases can't be replaced.
51
+ ddc then pins the new version, as
52
+ [ddc's export worker README](../../dcr-compiler/ddc/src/archv2/data_room/export_connector/README.md)
53
+ describes.
@@ -1,5 +1,5 @@
1
1
  # generated by datamodel-codegen:
2
- # filename: application_message.json
2
+ # filename: application_error.json
3
3
 
4
4
  from __future__ import annotations
5
5
 
@@ -8,7 +8,7 @@ from typing import Annotated, Any
8
8
  from pydantic import BaseModel, ConfigDict, Field
9
9
 
10
10
 
11
- class ApplicationMessage(BaseModel):
11
+ class ApplicationError(BaseModel):
12
12
  model_config = ConfigDict(
13
13
  populate_by_name=True,
14
14
  )
@@ -1,5 +1,5 @@
1
1
  # generated by datamodel-codegen:
2
- # filename: snap_validation_result.json
2
+ # filename: application_warning.json
3
3
 
4
4
  from __future__ import annotations
5
5
 
@@ -8,14 +8,14 @@ from typing import Annotated, Any
8
8
  from pydantic import BaseModel, ConfigDict, Field
9
9
 
10
10
 
11
- class ApplicationMessage(BaseModel):
11
+ class ApplicationWarning(BaseModel):
12
12
  model_config = ConfigDict(
13
13
  populate_by_name=True,
14
14
  )
15
15
  code: Annotated[
16
16
  str,
17
17
  Field(
18
- description='SCREAMING_SNAKE_CASE, such as `ACCESS_DENIED`. A string rather than an\nenum, so a worker release can add codes that readers built against an\nolder ddc still accept.'
18
+ description='SCREAMING_SNAKE_CASE, such as `EMPTY_DATASET`. A string rather than an\nenum, so a worker release can add codes that readers built against an\nolder ddc still accept.'
19
19
  ),
20
20
  ]
21
21
  details: Annotated[
@@ -27,11 +27,3 @@ class ApplicationMessage(BaseModel):
27
27
  description='Safe to show to the user: no credentials and no dataset values.'
28
28
  ),
29
29
  ]
30
-
31
-
32
- class SnapValidationResult(BaseModel):
33
- model_config = ConfigDict(
34
- populate_by_name=True,
35
- )
36
- error: ApplicationMessage | None = None
37
- warnings: list[ApplicationMessage]
@@ -56,57 +56,6 @@ class BucketExportCredentials(
56
56
  ]
57
57
 
58
58
 
59
- class GrantTokenRefreshToken(BaseModel):
60
- model_config = ConfigDict(
61
- populate_by_name=True,
62
- )
63
- type: Literal['refreshToken']
64
- value: str
65
-
66
-
67
- class GrantTokenAccessToken(BaseModel):
68
- model_config = ConfigDict(
69
- populate_by_name=True,
70
- )
71
- type: Literal['accessToken']
72
- value: str
73
-
74
-
75
- class GrantToken(RootModel[GrantTokenRefreshToken | GrantTokenAccessToken]):
76
- root: GrantTokenRefreshToken | GrantTokenAccessToken
77
-
78
-
79
- class OAuthGrant(BaseModel):
80
- model_config = ConfigDict(
81
- populate_by_name=True,
82
- )
83
- client_id: Annotated[
84
- str,
85
- Field(
86
- alias='clientId',
87
- description='The OAuth App the grant was issued to; it only works with that app.',
88
- ),
89
- ]
90
- obtained_at: Annotated[
91
- str, Field(alias='obtainedAt', description='RFC 3339, in UTC.')
92
- ]
93
- token: GrantToken
94
-
95
-
96
- class SnapExportCredentialsOauth(BaseModel):
97
- model_config = ConfigDict(
98
- populate_by_name=True,
99
- )
100
- grant: OAuthGrant
101
- type: Literal['oauth']
102
-
103
-
104
- class SnapExportCredentials(RootModel[SnapExportCredentialsOauth]):
105
- root: Annotated[
106
- SnapExportCredentialsOauth, Field(description='What is sealed for Snap.')
107
- ]
108
-
109
-
110
59
  class ExportConnectorCredentialsBucket(BaseModel):
111
60
  model_config = ConfigDict(
112
61
  populate_by_name=True,
@@ -115,19 +64,9 @@ class ExportConnectorCredentialsBucket(BaseModel):
115
64
  type: Literal['bucket']
116
65
 
117
66
 
118
- class ExportConnectorCredentialsSnap(BaseModel):
119
- model_config = ConfigDict(
120
- populate_by_name=True,
121
- )
122
- credentials: SnapExportCredentials
123
- type: Literal['snap']
124
-
125
-
126
- class ExportConnectorCredentials(
127
- RootModel[ExportConnectorCredentialsBucket | ExportConnectorCredentialsSnap]
128
- ):
67
+ class ExportConnectorCredentials(RootModel[ExportConnectorCredentialsBucket]):
129
68
  root: Annotated[
130
- ExportConnectorCredentialsBucket | ExportConnectorCredentialsSnap,
69
+ ExportConnectorCredentialsBucket,
131
70
  Field(
132
71
  description='Keyed by Connector Kind, in step with [`ExportConnectorKind`]. The worker\nreads it at `/input/credentials.json`.',
133
72
  title='ExportConnectorCredentials',
@@ -3,11 +3,9 @@
3
3
 
4
4
  from __future__ import annotations
5
5
 
6
- from enum import Enum
7
6
  from typing import Annotated, Literal
8
7
 
9
8
  from pydantic import BaseModel, ConfigDict, Field, RootModel
10
- from typing_extensions import TypeAliasType
11
9
 
12
10
 
13
11
  class BucketConnectionS3(BaseModel):
@@ -64,70 +62,6 @@ class ExportTotals(BaseModel):
64
62
  ] = None
65
63
 
66
64
 
67
- class MergeMode(Enum):
68
- add = 'ADD'
69
- replace = 'REPLACE'
70
-
71
-
72
- InvalidReasonsAdditionalProperty = TypeAliasType(
73
- "InvalidReasonsAdditionalProperty", Annotated[int, Field(ge=0)]
74
- )
75
-
76
-
77
- class SegmentCounts(BaseModel):
78
- model_config = ConfigDict(
79
- populate_by_name=True,
80
- )
81
- invalid: Annotated[int, Field(ge=0)]
82
- invalid_reasons: Annotated[
83
- dict[str, InvalidReasonsAdditionalProperty],
84
- Field(
85
- alias='invalidReasons',
86
- description='Invalid rows per reason, such as `EMAIL_NO_AT_SIGN`.',
87
- ),
88
- ]
89
- rejected_by_platform: Annotated[
90
- int | None,
91
- Field(
92
- alias='rejectedByPlatform',
93
- description="`None` where the platform doesn't say.",
94
- ge=0,
95
- ),
96
- ] = None
97
- rows: Annotated[
98
- int, Field(description='Non-empty lines read from the Input.', ge=0)
99
- ]
100
- submitted: Annotated[
101
- int,
102
- Field(
103
- description='Values sent to the platform, also from an Input that failed partway.',
104
- ge=0,
105
- ),
106
- ]
107
- valid: Annotated[int, Field(ge=0)]
108
-
109
-
110
- class SegmentTotals(BaseModel):
111
- model_config = ConfigDict(
112
- populate_by_name=True,
113
- )
114
- invalid: Annotated[int, Field(ge=0)]
115
- rows: Annotated[int, Field(ge=0)]
116
- submitted: Annotated[int, Field(ge=0)]
117
- valid: Annotated[int, Field(ge=0)]
118
-
119
-
120
- class SnapSegmentStatus(BaseModel):
121
- model_config = ConfigDict(
122
- populate_by_name=True,
123
- )
124
- approximate_number_users: Annotated[
125
- int | None, Field(alias='approximateNumberUsers', ge=0)
126
- ] = None
127
- targetable_status: Annotated[str | None, Field(alias='targetableStatus')] = None
128
- upload_status: Annotated[str | None, Field(alias='uploadStatus')] = None
129
-
130
-
131
65
  class BucketInputReceipt(BaseModel):
132
66
  model_config = ConfigDict(
133
67
  populate_by_name=True,
@@ -161,29 +95,8 @@ class ExportReceiptV0Bucket(BaseModel):
161
95
  type: Literal['BUCKET']
162
96
 
163
97
 
164
- class SnapInputReceipt(BaseModel):
165
- model_config = ConfigDict(
166
- populate_by_name=True,
167
- )
168
- counts: SegmentCounts
169
- created: Annotated[bool, Field(description='Whether this run created the Segment.')]
170
- leaf_id: Annotated[str, Field(alias='leafId')]
171
- merge_mode: Annotated[MergeMode, Field(alias='mergeMode')]
172
- segment_id: Annotated[
173
- str | None,
174
- Field(
175
- alias='segmentId',
176
- description='`None` until the run found or created the Segment.',
177
- ),
178
- ] = None
179
- segment_name: Annotated[str, Field(alias='segmentName')]
180
- segment_status: Annotated[
181
- SnapSegmentStatus | None,
182
- Field(
183
- alias='segmentStatus',
184
- description='The Segment as Snap reported it after the upload.',
185
- ),
186
- ] = None
98
+ class ExportReceiptV0(RootModel[ExportReceiptV0Bucket]):
99
+ root: ExportReceiptV0Bucket
187
100
 
188
101
 
189
102
  class VersionedExportReceiptV0Bucket(BaseModel):
@@ -206,22 +119,9 @@ class VersionedExportReceiptV0Bucket(BaseModel):
206
119
  type: Literal['BUCKET']
207
120
 
208
121
 
209
- class VersionedExportReceiptV0Snap(BaseModel):
210
- model_config = ConfigDict(
211
- populate_by_name=True,
212
- )
213
- version: Literal['V0']
214
- ad_account_id: Annotated[str, Field(alias='adAccountId')]
215
- inputs: list[SnapInputReceipt]
216
- totals: SegmentTotals
217
- type: Literal['SNAP']
218
-
219
-
220
- class ExportReceipt(
221
- RootModel[VersionedExportReceiptV0Bucket | VersionedExportReceiptV0Snap]
222
- ):
122
+ class ExportReceipt(RootModel[VersionedExportReceiptV0Bucket]):
223
123
  root: Annotated[
224
- VersionedExportReceiptV0Bucket | VersionedExportReceiptV0Snap,
124
+ VersionedExportReceiptV0Bucket,
225
125
  Field(
226
126
  description='What an Export Connector Run sent and where. api-platform reads it in\nplaintext, so it holds only metadata, never dataset values. A released\nversion never changes: a change is a new version, and readers keep reading\nevery version ever written.',
227
127
  title='ExportReceipt',
@@ -245,26 +145,3 @@ class BucketExportReceiptV0(BaseModel):
245
145
  ] = None
246
146
  inputs: list[BucketInputReceipt]
247
147
  totals: ExportTotals
248
-
249
-
250
- class ExportReceiptV0Snap(BaseModel):
251
- model_config = ConfigDict(
252
- populate_by_name=True,
253
- )
254
- ad_account_id: Annotated[str, Field(alias='adAccountId')]
255
- inputs: list[SnapInputReceipt]
256
- totals: SegmentTotals
257
- type: Literal['SNAP']
258
-
259
-
260
- class ExportReceiptV0(RootModel[ExportReceiptV0Bucket | ExportReceiptV0Snap]):
261
- root: ExportReceiptV0Bucket | ExportReceiptV0Snap
262
-
263
-
264
- class SnapExportReceiptV0(BaseModel):
265
- model_config = ConfigDict(
266
- populate_by_name=True,
267
- )
268
- ad_account_id: Annotated[str, Field(alias='adAccountId')]
269
- inputs: list[SnapInputReceipt]
270
- totals: SegmentTotals
@@ -3,8 +3,7 @@
3
3
 
4
4
  from __future__ import annotations
5
5
 
6
- from enum import Enum
7
- from typing import Annotated, Any, Literal
6
+ from typing import Annotated, Literal
8
7
 
9
8
  from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, RootModel
10
9
 
@@ -57,21 +56,6 @@ class BucketInput(BaseModel):
57
56
  leaf_id: Annotated[str, Field(alias='leafId')]
58
57
 
59
58
 
60
- class ClientAuth(Enum):
61
- form_body = 'formBody'
62
- http_basic = 'httpBasic'
63
-
64
-
65
- class ExportConnectorDcrComputeActionListDestinationAccounts(BaseModel):
66
- model_config = ConfigDict(
67
- extra='forbid',
68
- populate_by_name=True,
69
- )
70
- list_destination_accounts: Annotated[
71
- dict[str, Any], Field(alias='listDestinationAccounts')
72
- ]
73
-
74
-
75
59
  class ExportConnectorKindBucket(BaseModel):
76
60
  model_config = ConfigDict(
77
61
  populate_by_name=True,
@@ -88,47 +72,19 @@ class ExportConnectorKindBucket(BaseModel):
88
72
  type: Literal['bucket']
89
73
 
90
74
 
91
- class ExportParamsBucket(BaseModel):
92
- model_config = ConfigDict(
93
- populate_by_name=True,
94
- )
95
- type: Literal['bucket']
75
+ class ExportConnectorKind(RootModel[ExportConnectorKindBucket]):
76
+ root: ExportConnectorKindBucket
96
77
 
97
78
 
98
- class ExportParamsSnap(BaseModel):
79
+ class ExportParamsBucket(BaseModel):
99
80
  model_config = ConfigDict(
100
81
  populate_by_name=True,
101
82
  )
102
- type: Literal['snap']
103
-
104
-
105
- class ExportParams(RootModel[ExportParamsBucket | ExportParamsSnap]):
106
- root: ExportParamsBucket | ExportParamsSnap
107
-
108
-
109
- class IdentifierType(Enum):
110
- email = 'EMAIL'
111
- email_sha256 = 'EMAIL_SHA256'
112
- phone = 'PHONE'
113
- phone_sha256 = 'PHONE_SHA256'
114
- idfa = 'IDFA'
115
- idfa_sha256 = 'IDFA_SHA256'
116
- gaid = 'GAID'
117
- gaid_sha256 = 'GAID_SHA256'
83
+ type: Literal['bucket']
118
84
 
119
85
 
120
- class MergeMode(Enum):
121
- add = 'ADD'
122
- replace = 'REPLACE'
123
-
124
-
125
- class OAuthWorkerConfig(BaseModel):
126
- model_config = ConfigDict(
127
- populate_by_name=True,
128
- )
129
- client_auth: Annotated[ClientAuth, Field(alias='clientAuth')]
130
- platform_secret: Annotated[str, Field(alias='platformSecret')]
131
- token_url: Annotated[str, Field(alias='tokenUrl')]
86
+ class ExportParams(RootModel[ExportParamsBucket]):
87
+ root: ExportParamsBucket
132
88
 
133
89
 
134
90
  class ProvisionedPolicy(BaseModel):
@@ -149,30 +105,6 @@ class ProvisionedPolicy(BaseModel):
149
105
  ]
150
106
 
151
107
 
152
- class SnapInput(BaseModel):
153
- model_config = ConfigDict(
154
- populate_by_name=True,
155
- )
156
- identifier_type: Annotated[IdentifierType, Field(alias='identifierType')]
157
- leaf_id: Annotated[str, Field(alias='leafId')]
158
- merge_mode: Annotated[MergeMode, Field(alias='mergeMode')]
159
- retention_days: Annotated[
160
- int | None,
161
- Field(
162
- alias='retentionDays',
163
- description='Applied when the Segment is created.',
164
- ge=0,
165
- ),
166
- ] = None
167
- segment_name: Annotated[
168
- str,
169
- Field(
170
- alias='segmentName',
171
- description='The Segment is found by this name in the ad account, or created.',
172
- ),
173
- ]
174
-
175
-
176
108
  class ValidateConnectionParamsBucket(BaseModel):
177
109
  model_config = ConfigDict(
178
110
  populate_by_name=True,
@@ -180,17 +112,8 @@ class ValidateConnectionParamsBucket(BaseModel):
180
112
  type: Literal['bucket']
181
113
 
182
114
 
183
- class ValidateConnectionParamsSnap(BaseModel):
184
- model_config = ConfigDict(
185
- populate_by_name=True,
186
- )
187
- type: Literal['snap']
188
-
189
-
190
- class ValidateConnectionParams(
191
- RootModel[ValidateConnectionParamsBucket | ValidateConnectionParamsSnap]
192
- ):
193
- root: ValidateConnectionParamsBucket | ValidateConnectionParamsSnap
115
+ class ValidateConnectionParams(RootModel[ValidateConnectionParamsBucket]):
116
+ root: ValidateConnectionParamsBucket
194
117
 
195
118
 
196
119
  class BucketExportConfig(BaseModel):
@@ -244,54 +167,17 @@ class ExportConnectorDcrComputeAction(
244
167
  RootModel[
245
168
  ExportConnectorDcrComputeActionValidateConnection
246
169
  | ExportConnectorDcrComputeActionExport
247
- | ExportConnectorDcrComputeActionListDestinationAccounts
248
170
  ]
249
171
  ):
250
172
  root: Annotated[
251
173
  ExportConnectorDcrComputeActionValidateConnection
252
- | ExportConnectorDcrComputeActionExport
253
- | ExportConnectorDcrComputeActionListDestinationAccounts,
174
+ | ExportConnectorDcrComputeActionExport,
254
175
  Field(
255
176
  description='Compute actions for an Export Connector DCR, started through `POST /jobs`.'
256
177
  ),
257
178
  ]
258
179
 
259
180
 
260
- class ExportConnectorKindSnap(BaseModel):
261
- model_config = ConfigDict(
262
- populate_by_name=True,
263
- )
264
- ad_account_id: Annotated[
265
- str | None,
266
- Field(
267
- alias='adAccountId',
268
- description='A canonical, lowercase UUID. `None` until the owner picks one from the\nad accounts the grant reaches.',
269
- ),
270
- ] = None
271
- inputs: list[SnapInput]
272
- type: Literal['snap']
273
-
274
-
275
- class ExportConnectorKind(
276
- RootModel[ExportConnectorKindBucket | ExportConnectorKindSnap]
277
- ):
278
- root: ExportConnectorKindBucket | ExportConnectorKindSnap
279
-
280
-
281
- class SnapExportConfig(BaseModel):
282
- model_config = ConfigDict(
283
- populate_by_name=True,
284
- )
285
- ad_account_id: Annotated[
286
- str | None,
287
- Field(
288
- alias='adAccountId',
289
- description='A canonical, lowercase UUID. `None` until the owner picks one from the\nad accounts the grant reaches.',
290
- ),
291
- ] = None
292
- inputs: list[SnapInput]
293
-
294
-
295
181
  class ExportWorkerConfig(BaseModel):
296
182
  model_config = ConfigDict(
297
183
  populate_by_name=True,
@@ -302,8 +188,4 @@ class ExportWorkerConfig(BaseModel):
302
188
  AwareDatetime | None,
303
189
  Field(alias='credentialsExpireAt', description='From the Credentials Info.'),
304
190
  ] = None
305
- oauth: Annotated[
306
- OAuthWorkerConfig | None,
307
- Field(description='For a kind whose credentials are an OAuth Grant.'),
308
- ] = None
309
191
  policies: list[ProvisionedPolicy]
@@ -12,10 +12,10 @@ from datetime import datetime
12
12
  from pathlib import Path
13
13
  from typing import Any
14
14
 
15
+ from dq_export_connector.bucket.datasets import DatasetFile, open_dataset
15
16
  from dq_export_connector.bucket.paths import InvalidPathError, check_dataset_path, check_key, fill_date_tokens, join_key
16
17
  from dq_export_connector.bucket.store import StorageError, classify_error, describe_destination, failure_sentence
17
18
  from dq_export_connector.bucket.upload import plan_upload, upload
18
- from dq_export_connector.datasets import DatasetFile, open_dataset
19
19
  from dq_export_connector.errors import ErrorCode, ExportConnectorError, WarningCode
20
20
  from dq_export_connector.log import logger
21
21
  from dq_export_connector.models import ExportReceiptV0, ExportTotals, ProvisionedPolicy