salesforce-data-customcode 7.0.0rc4__tar.gz → 7.0.1rc2__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.
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/PKG-INFO +13 -1
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/README.md +12 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/pyproject.toml +1 -1
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/auth.py +72 -13
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/cli.py +21 -6
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/client.py +19 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/constants.py +4 -3
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/deploy.py +35 -18
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/writer/base.py +33 -1
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/scan.py +26 -6
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/chunking/payload/tests/test.json +33 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_external_callout/README.md +120 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_external_callout/entrypoint.py +162 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_external_callout/external_callout_config.json +11 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_external_callout/tests/test.json +16 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_prediction/config.json +3 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/script/examples/external_callout/README.md +169 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/script/examples/external_callout/entrypoint.py +144 -0
- salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/script/examples/external_callout/external_callout_config.json +11 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/LICENSE.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/cmd.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/common_config.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/config.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/config.yaml +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/credentials.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_platform_client.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_platform_config.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/errors.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/impl/default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/spark_base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/spark_default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions/types.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/einstein_predictions_config.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/file/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/file/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/file/path/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/file/path/default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/function/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/function/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/function/feature_types/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/function/feature_types/chunking.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/function/runtime.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/function_utils.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/cdf.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/local_deltas.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/query_api.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/sf_cli.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/streaming_seeder.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/reader/utils.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/writer/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/writer/csv.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/writer/local_deltas.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/io/writer/print.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/lineage/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/lineage/_worker.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/lineage/capture.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/lineage/tracer.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/errors.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/spark_base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/spark_default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/types/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/types/generate_text_request.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/types/generate_text_request_builder.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/types/generate_text_response.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway/types/generate_text_response_builder.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/llm_gateway_config.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/mixin.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/direct/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/direct/auth.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/direct/credentials.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/direct/transport.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/direct/url_resolver.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/errors.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/spark_base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/spark_default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/types/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/types/http_method.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/types/http_request.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/types/http_request_builder.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/types/http_response.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential/types/http_response_builder.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/named_credential_config.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/py.typed +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/run.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/spark/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/spark/base.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/spark/column_hints.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/spark/default.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/template.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/__init__.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/.devcontainer/devcontainer.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/Dockerfile.dependencies +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/README.md +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/build_native_dependencies.sh +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/chunking/payload/config.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/chunking/payload/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/chunking/requirements.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4/src/datacustomcode/templates/function/example/chunking_with_llm → salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_external_callout}/config.json +0 -0
- {salesforce_data_customcode-7.0.0rc4/src/datacustomcode/templates/function/example/chunking_with_prediction → salesforce_data_customcode-7.0.1rc2/src/datacustomcode/templates/function/example/chunking_with_llm}/config.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/example/chunking_with_llm/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/example/chunking_with_llm/files/chunking_prompt.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/example/chunking_with_llm/tests/test.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/example/chunking_with_prediction/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/example/chunking_with_prediction/tests/test.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/payload/config.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/payload/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/payload/utility.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/requirements-dev.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/function/requirements.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/.devcontainer/devcontainer.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/Dockerfile +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/Dockerfile.dependencies +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/README.md +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/account.ipynb +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/build_native_dependencies.sh +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/examples/employee_hierarchy/employee_data.csv +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/examples/employee_hierarchy/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/examples/streaming_deltas/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/jupyterlab.sh +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/payload/config.json +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/payload/entrypoint.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/requirements-dev.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/templates/script/requirements.txt +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/token_provider.py +0 -0
- {salesforce_data_customcode-7.0.0rc4 → salesforce_data_customcode-7.0.1rc2}/src/datacustomcode/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: salesforce-data-customcode
|
|
3
|
-
Version: 7.0.
|
|
3
|
+
Version: 7.0.1rc2
|
|
4
4
|
Summary: Data Cloud Custom Code SDK
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE.txt
|
|
@@ -183,6 +183,7 @@ For a streaming (delta) transform, use `StreamingClient`, which exposes the stre
|
|
|
183
183
|
* `read_dlo_deltas()` – Read the streaming change feed (deltas) of a Data Lake Object as a streaming DataFrame.
|
|
184
184
|
* `read_dmo_deltas()` – Read the streaming change feed (deltas) of a Data Model Object as a streaming DataFrame.
|
|
185
185
|
* `write_dlo_deltas(name, spark_dataframe)` – Write a streaming DataFrame of deltas to a Data Lake Object; returns the started `StreamingQuery`
|
|
186
|
+
* `write_dmo_deltas(name, spark_dataframe)` – Write a streaming DataFrame of deltas to a Data Model Object; returns the started `StreamingQuery`
|
|
186
187
|
|
|
187
188
|
`find_file_path`, `llm_gateway_generate_text`, and `einstein_predict` are available on both clients.
|
|
188
189
|
|
|
@@ -247,6 +248,15 @@ query = client.write_dlo_deltas("Output__dll", transformed)
|
|
|
247
248
|
query.awaitTermination()
|
|
248
249
|
```
|
|
249
250
|
|
|
251
|
+
A streaming transform can also read and write Data Model Objects with `read_dmo_deltas()` and `write_dmo_deltas()`:
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
deltas = client.read_dmo_deltas()
|
|
255
|
+
transformed = deltas.withColumn("description__c", upper(col("description__c")))
|
|
256
|
+
query = client.write_dmo_deltas("Output__dlm", transformed)
|
|
257
|
+
query.awaitTermination()
|
|
258
|
+
```
|
|
259
|
+
|
|
250
260
|
Notes:
|
|
251
261
|
|
|
252
262
|
- These methods only run inside the Data Cloud streaming (`DELTA_SYNC`) runtime. Locally (`datacustomcode run`) they raise `NotImplementedError`, since there is no change feed to stream.
|
|
@@ -408,6 +418,8 @@ Options:
|
|
|
408
418
|
#### `datacustomcode zip`
|
|
409
419
|
Zip a transformation job in preparation to upload to Data Cloud. Make sure to change directory into your code package folder (e.g., `my_package`) before running this command.
|
|
410
420
|
|
|
421
|
+
Symlinks inside the payload folder are not followed or packaged. Each symlinked file that is skipped is reported with a warning, and symlinked directories are not included. `datacustomcode deploy` zips the same way.
|
|
422
|
+
|
|
411
423
|
Arguments:
|
|
412
424
|
- `PATH`: Path to the code directory i.e. the payload folder (default: "payload")
|
|
413
425
|
|
|
@@ -158,6 +158,7 @@ For a streaming (delta) transform, use `StreamingClient`, which exposes the stre
|
|
|
158
158
|
* `read_dlo_deltas()` – Read the streaming change feed (deltas) of a Data Lake Object as a streaming DataFrame.
|
|
159
159
|
* `read_dmo_deltas()` – Read the streaming change feed (deltas) of a Data Model Object as a streaming DataFrame.
|
|
160
160
|
* `write_dlo_deltas(name, spark_dataframe)` – Write a streaming DataFrame of deltas to a Data Lake Object; returns the started `StreamingQuery`
|
|
161
|
+
* `write_dmo_deltas(name, spark_dataframe)` – Write a streaming DataFrame of deltas to a Data Model Object; returns the started `StreamingQuery`
|
|
161
162
|
|
|
162
163
|
`find_file_path`, `llm_gateway_generate_text`, and `einstein_predict` are available on both clients.
|
|
163
164
|
|
|
@@ -222,6 +223,15 @@ query = client.write_dlo_deltas("Output__dll", transformed)
|
|
|
222
223
|
query.awaitTermination()
|
|
223
224
|
```
|
|
224
225
|
|
|
226
|
+
A streaming transform can also read and write Data Model Objects with `read_dmo_deltas()` and `write_dmo_deltas()`:
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
deltas = client.read_dmo_deltas()
|
|
230
|
+
transformed = deltas.withColumn("description__c", upper(col("description__c")))
|
|
231
|
+
query = client.write_dmo_deltas("Output__dlm", transformed)
|
|
232
|
+
query.awaitTermination()
|
|
233
|
+
```
|
|
234
|
+
|
|
225
235
|
Notes:
|
|
226
236
|
|
|
227
237
|
- These methods only run inside the Data Cloud streaming (`DELTA_SYNC`) runtime. Locally (`datacustomcode run`) they raise `NotImplementedError`, since there is no change feed to stream.
|
|
@@ -383,6 +393,8 @@ Options:
|
|
|
383
393
|
#### `datacustomcode zip`
|
|
384
394
|
Zip a transformation job in preparation to upload to Data Cloud. Make sure to change directory into your code package folder (e.g., `my_package`) before running this command.
|
|
385
395
|
|
|
396
|
+
Symlinks inside the payload folder are not followed or packaged. Each symlinked file that is skipped is reported with a warning, and symlinked directories are not included. `datacustomcode deploy` zips the same way.
|
|
397
|
+
|
|
386
398
|
Arguments:
|
|
387
399
|
- `PATH`: Path to the code directory i.e. the payload folder (default: "payload")
|
|
388
400
|
|
|
@@ -12,13 +12,21 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
+
import base64
|
|
16
|
+
import hashlib
|
|
17
|
+
import hmac
|
|
15
18
|
import http.server
|
|
16
19
|
import queue
|
|
20
|
+
import secrets
|
|
17
21
|
import socketserver
|
|
18
22
|
import threading
|
|
19
23
|
import time
|
|
20
24
|
from typing import Any
|
|
21
|
-
from urllib.parse import
|
|
25
|
+
from urllib.parse import (
|
|
26
|
+
parse_qs,
|
|
27
|
+
urlencode,
|
|
28
|
+
urlparse,
|
|
29
|
+
)
|
|
22
30
|
import webbrowser
|
|
23
31
|
|
|
24
32
|
import click
|
|
@@ -28,16 +36,35 @@ import requests
|
|
|
28
36
|
class OAuthCallbackHandler(http.server.SimpleHTTPRequestHandler):
|
|
29
37
|
"""HTTP request handler to capture OAuth callback."""
|
|
30
38
|
|
|
31
|
-
def __init__(self, *args, auth_code_queue=None, **kwargs):
|
|
39
|
+
def __init__(self, *args, auth_code_queue=None, expected_state=None, **kwargs):
|
|
32
40
|
self.auth_code_queue = auth_code_queue
|
|
41
|
+
self.expected_state = expected_state
|
|
33
42
|
super().__init__(*args, **kwargs)
|
|
34
43
|
|
|
44
|
+
def _state_matches(self, query_params: dict) -> bool:
|
|
45
|
+
"""Check the callback's state parameter against the expected value."""
|
|
46
|
+
received = query_params.get("state", [""])[0]
|
|
47
|
+
if not self.expected_state or not received:
|
|
48
|
+
return False
|
|
49
|
+
return hmac.compare_digest(received, self.expected_state)
|
|
50
|
+
|
|
35
51
|
def do_GET(self):
|
|
36
|
-
"""Handle GET request from OAuth callback.
|
|
52
|
+
"""Handle GET request from OAuth callback.
|
|
53
|
+
|
|
54
|
+
Callbacks whose ``state`` does not match are rejected without touching
|
|
55
|
+
the queue, so a forged request can neither inject an authorization code
|
|
56
|
+
nor abort the legitimate login.
|
|
57
|
+
"""
|
|
37
58
|
parsed_path = urlparse(self.path)
|
|
38
59
|
query_params = parse_qs(parsed_path.query)
|
|
39
60
|
|
|
40
|
-
|
|
61
|
+
is_callback = "code" in query_params or "error" in query_params
|
|
62
|
+
if is_callback and not self._state_matches(query_params):
|
|
63
|
+
self.send_response(400)
|
|
64
|
+
self.send_header("Content-type", "text/html")
|
|
65
|
+
self.end_headers()
|
|
66
|
+
self.wfile.write(b"<html><body><h1>Invalid callback</h1></body></html>")
|
|
67
|
+
elif "code" in query_params:
|
|
41
68
|
auth_code = query_params["code"][0]
|
|
42
69
|
self.auth_code_queue.put(auth_code)
|
|
43
70
|
self.send_response(200)
|
|
@@ -70,14 +97,27 @@ class OAuthCallbackHandler(http.server.SimpleHTTPRequestHandler):
|
|
|
70
97
|
"""Suppress default logging."""
|
|
71
98
|
|
|
72
99
|
|
|
100
|
+
def _generate_pkce_pair() -> tuple[str, str]:
|
|
101
|
+
"""Generate a PKCE (RFC 7636) code verifier and its S256 code challenge.
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
Tuple of (code_verifier, code_challenge)
|
|
105
|
+
"""
|
|
106
|
+
code_verifier = secrets.token_urlsafe(64)
|
|
107
|
+
digest = hashlib.sha256(code_verifier.encode("ascii")).digest()
|
|
108
|
+
code_challenge = base64.urlsafe_b64encode(digest).rstrip(b"=").decode("ascii")
|
|
109
|
+
return code_verifier, code_challenge
|
|
110
|
+
|
|
111
|
+
|
|
73
112
|
def _run_oauth_callback_server(
|
|
74
|
-
redirect_uri: str, auth_code_queue: "queue.Queue[str]"
|
|
113
|
+
redirect_uri: str, auth_code_queue: "queue.Queue[str]", expected_state: str
|
|
75
114
|
) -> tuple[socketserver.TCPServer, int]:
|
|
76
115
|
"""Start a local HTTP server to catch OAuth callback.
|
|
77
116
|
|
|
78
117
|
Args:
|
|
79
118
|
redirect_uri: The redirect URI configured in the OAuth app
|
|
80
119
|
auth_code_queue: Queue to put the authorization code in
|
|
120
|
+
expected_state: OAuth state value the callback must echo back
|
|
81
121
|
|
|
82
122
|
Returns:
|
|
83
123
|
Tuple of (server instance, actual port number)
|
|
@@ -90,7 +130,12 @@ def _run_oauth_callback_server(
|
|
|
90
130
|
|
|
91
131
|
# Create a custom handler factory
|
|
92
132
|
def handler_factory(*args, **kwargs):
|
|
93
|
-
return OAuthCallbackHandler(
|
|
133
|
+
return OAuthCallbackHandler(
|
|
134
|
+
*args,
|
|
135
|
+
auth_code_queue=auth_code_queue,
|
|
136
|
+
expected_state=expected_state,
|
|
137
|
+
**kwargs,
|
|
138
|
+
)
|
|
94
139
|
|
|
95
140
|
server = socketserver.TCPServer((host, port), handler_factory)
|
|
96
141
|
server.allow_reuse_address = True
|
|
@@ -113,6 +158,7 @@ def _exchange_code_for_tokens(
|
|
|
113
158
|
client_secret: str,
|
|
114
159
|
redirect_uri: str,
|
|
115
160
|
auth_code: str,
|
|
161
|
+
code_verifier: str,
|
|
116
162
|
) -> Any:
|
|
117
163
|
"""Exchange authorization code for access and refresh tokens.
|
|
118
164
|
|
|
@@ -122,6 +168,7 @@ def _exchange_code_for_tokens(
|
|
|
122
168
|
client_secret: OAuth client secret
|
|
123
169
|
redirect_uri: Redirect URI used in authorization
|
|
124
170
|
auth_code: Authorization code from callback
|
|
171
|
+
code_verifier: PKCE code verifier matching the authorize request
|
|
125
172
|
|
|
126
173
|
Returns:
|
|
127
174
|
Dictionary containing access_token and refresh_token
|
|
@@ -136,6 +183,7 @@ def _exchange_code_for_tokens(
|
|
|
136
183
|
"client_id": client_id,
|
|
137
184
|
"client_secret": client_secret,
|
|
138
185
|
"redirect_uri": redirect_uri,
|
|
186
|
+
"code_verifier": code_verifier,
|
|
139
187
|
}
|
|
140
188
|
|
|
141
189
|
try:
|
|
@@ -168,17 +216,28 @@ def do_oauth_browser_flow(
|
|
|
168
216
|
# Create queue for communication between server and main thread
|
|
169
217
|
auth_code_queue: queue.Queue[str] = queue.Queue()
|
|
170
218
|
|
|
219
|
+
# CSRF protection (RFC 6749 10.12) and PKCE (RFC 7636 / RFC 8252)
|
|
220
|
+
state = secrets.token_urlsafe(32)
|
|
221
|
+
code_verifier, code_challenge = _generate_pkce_pair()
|
|
222
|
+
|
|
171
223
|
# Start callback server
|
|
172
224
|
click.echo(f"\nStarting local callback server on {redirect_uri}...")
|
|
173
|
-
server, _actual_port = _run_oauth_callback_server(
|
|
225
|
+
server, _actual_port = _run_oauth_callback_server(
|
|
226
|
+
redirect_uri, auth_code_queue, state
|
|
227
|
+
)
|
|
174
228
|
|
|
175
229
|
# Build authorization URL with final redirect_uri
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
230
|
+
query = urlencode(
|
|
231
|
+
{
|
|
232
|
+
"response_type": "code",
|
|
233
|
+
"client_id": client_id,
|
|
234
|
+
"redirect_uri": redirect_uri,
|
|
235
|
+
"state": state,
|
|
236
|
+
"code_challenge": code_challenge,
|
|
237
|
+
"code_challenge_method": "S256",
|
|
238
|
+
}
|
|
181
239
|
)
|
|
240
|
+
auth_url = f"{login_url.rstrip('/')}/services/oauth2/authorize?{query}"
|
|
182
241
|
|
|
183
242
|
# Open browser
|
|
184
243
|
click.echo("Opening browser for authentication...")
|
|
@@ -208,7 +267,7 @@ def do_oauth_browser_flow(
|
|
|
208
267
|
# Exchange code for tokens
|
|
209
268
|
click.echo("Exchanging authorization code for tokens...")
|
|
210
269
|
token_response = _exchange_code_for_tokens(
|
|
211
|
-
login_url, client_id, client_secret, redirect_uri, auth_code
|
|
270
|
+
login_url, client_id, client_secret, redirect_uri, auth_code, code_verifier
|
|
212
271
|
)
|
|
213
272
|
|
|
214
273
|
refresh_token = token_response.get("refresh_token")
|
|
@@ -215,6 +215,7 @@ def deploy(
|
|
|
215
215
|
COMPUTE_TYPES,
|
|
216
216
|
CodeExtensionMetadata,
|
|
217
217
|
deploy_full,
|
|
218
|
+
describe_supported_signatures,
|
|
218
219
|
infer_use_in_feature,
|
|
219
220
|
)
|
|
220
221
|
from datacustomcode.token_provider import (
|
|
@@ -252,8 +253,9 @@ def deploy(
|
|
|
252
253
|
else:
|
|
253
254
|
click.secho(
|
|
254
255
|
"Error: Function signature does not match a supported type. "
|
|
255
|
-
"Use
|
|
256
|
-
"
|
|
256
|
+
"Use a supported Request/Response pair in the function "
|
|
257
|
+
"signature. For example, "
|
|
258
|
+
f"{describe_supported_signatures(entrypoint_path)}.",
|
|
257
259
|
fg="red",
|
|
258
260
|
)
|
|
259
261
|
raise click.Abort()
|
|
@@ -349,14 +351,27 @@ def init(directory: str, code_type: str, use_in_feature: Optional[str]):
|
|
|
349
351
|
+ " to automatically update config.json when you make changes to your code"
|
|
350
352
|
)
|
|
351
353
|
|
|
352
|
-
#
|
|
354
|
+
# Prefer the sample tests/test.json shipped in the template; only
|
|
355
|
+
# generate one from the request model if the template doesn't have it
|
|
353
356
|
if code_type == "function":
|
|
354
|
-
|
|
355
|
-
|
|
357
|
+
template_test_json = os.path.join(
|
|
358
|
+
os.path.dirname(entrypoint_path), TESTS_DIR, TEST_FILE
|
|
359
|
+
)
|
|
360
|
+
test_json_path: Optional[str]
|
|
361
|
+
if os.path.isfile(template_test_json):
|
|
362
|
+
test_json_path = template_test_json
|
|
356
363
|
click.echo(
|
|
357
|
-
"
|
|
364
|
+
"Sample test file at "
|
|
358
365
|
+ click.style(test_json_path, fg="blue", bold=True)
|
|
359
366
|
)
|
|
367
|
+
else:
|
|
368
|
+
test_json_path = _generate_function_test_file(entrypoint_path)
|
|
369
|
+
if test_json_path:
|
|
370
|
+
click.echo(
|
|
371
|
+
"Generated test file at "
|
|
372
|
+
+ click.style(test_json_path, fg="blue", bold=True)
|
|
373
|
+
)
|
|
374
|
+
if test_json_path:
|
|
360
375
|
click.echo(
|
|
361
376
|
"Test your function locally with "
|
|
362
377
|
+ click.style(
|
|
@@ -726,6 +726,25 @@ class StreamingClient(_BaseClient):
|
|
|
726
726
|
self._validate_data_layer_history_does_not_contain(DataCloudObjectType.DMO)
|
|
727
727
|
return self._writer.write_dlo_deltas(name, dataframe, **kwargs) # type: ignore[no-any-return]
|
|
728
728
|
|
|
729
|
+
def write_dmo_deltas(
|
|
730
|
+
self, name: str, dataframe: PySparkDataFrame, **kwargs
|
|
731
|
+
) -> StreamingQuery:
|
|
732
|
+
"""Write a streaming DataFrame of deltas to a DMO in Data Cloud.
|
|
733
|
+
|
|
734
|
+
Starts a streaming query that writes each micro-batch to the
|
|
735
|
+
target DMO and returns the ``StreamingQuery`` handle; the caller
|
|
736
|
+
typically calls ``query.awaitTermination()``.
|
|
737
|
+
|
|
738
|
+
Args:
|
|
739
|
+
name: The name of the DMO to write to.
|
|
740
|
+
dataframe: The streaming PySpark DataFrame to write.
|
|
741
|
+
|
|
742
|
+
Returns:
|
|
743
|
+
The started ``StreamingQuery``.
|
|
744
|
+
"""
|
|
745
|
+
self._validate_data_layer_history_does_not_contain(DataCloudObjectType.DLO)
|
|
746
|
+
return self._writer.write_dmo_deltas(name, dataframe, **kwargs) # type: ignore[no-any-return]
|
|
747
|
+
|
|
729
748
|
def auto_write_to_dlo(self, name: str, dataframe: PySparkDataFrame) -> None:
|
|
730
749
|
"""Write a PySpark DataFrame to a DLO in Data Cloud automatically picking
|
|
731
750
|
the WriteMode.
|
|
@@ -46,8 +46,9 @@ SCRIPT_USE_IN_FEATURE_OPTIONS = [
|
|
|
46
46
|
SCRIPT_USE_IN_FEATURE_STREAMING,
|
|
47
47
|
]
|
|
48
48
|
|
|
49
|
-
#
|
|
49
|
+
# (request type name, response type name) pair to feature name
|
|
50
50
|
REQUEST_TYPE_TO_FEATURE = {
|
|
51
|
-
"SearchIndexChunkingV1Request"
|
|
52
|
-
|
|
51
|
+
("SearchIndexChunkingV1Request", "SearchIndexChunkingV1Response"): (
|
|
52
|
+
"SearchIndexChunking"
|
|
53
|
+
),
|
|
53
54
|
}
|
|
@@ -95,15 +95,35 @@ def infer_use_in_feature(entrypoint_path: str) -> Union[str, None]:
|
|
|
95
95
|
if not request_type_name or not response_type_name:
|
|
96
96
|
return None
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
request_feature = REQUEST_TYPE_TO_FEATURE.get(request_type_name)
|
|
100
|
-
response_feature = REQUEST_TYPE_TO_FEATURE.get(response_type_name)
|
|
98
|
+
return REQUEST_TYPE_TO_FEATURE.get((request_type_name, response_type_name))
|
|
101
99
|
|
|
102
|
-
# Both must be present and must match
|
|
103
|
-
if request_feature and response_feature and request_feature == response_feature:
|
|
104
|
-
return request_feature
|
|
105
100
|
|
|
106
|
-
|
|
101
|
+
def describe_supported_signatures(entrypoint_path: str) -> str:
|
|
102
|
+
"""Build a contract-mismatch hint based on the function's feature type.
|
|
103
|
+
|
|
104
|
+
If the request or response type belongs to a known feature, only that
|
|
105
|
+
feature's expected pair is listed; otherwise all supported pairs are.
|
|
106
|
+
Each pair is followed by the use_in_feature it maps to, e.g.
|
|
107
|
+
``Req/Resp for use_in_feature: SearchIndexChunking``.
|
|
108
|
+
"""
|
|
109
|
+
from datacustomcode.function_utils import inspect_function_types_static
|
|
110
|
+
|
|
111
|
+
request_type_name, response_type_name = inspect_function_types_static(
|
|
112
|
+
entrypoint_path
|
|
113
|
+
)
|
|
114
|
+
supported = list(REQUEST_TYPE_TO_FEATURE.items())
|
|
115
|
+
sharing_a_type = [
|
|
116
|
+
((expected_request, expected_response), feature)
|
|
117
|
+
for (expected_request, expected_response), feature in supported
|
|
118
|
+
if request_type_name == expected_request
|
|
119
|
+
or response_type_name == expected_response
|
|
120
|
+
]
|
|
121
|
+
# Narrow the hint only when the detected types point at a single feature
|
|
122
|
+
to_show = sharing_a_type if len(sharing_a_type) == 1 else supported
|
|
123
|
+
return " or ".join(
|
|
124
|
+
f"{expected_request}/{expected_response} for use_in_feature: {feature}"
|
|
125
|
+
for (expected_request, expected_response), feature in to_show
|
|
126
|
+
)
|
|
107
127
|
|
|
108
128
|
|
|
109
129
|
class CodeExtensionMetadata(BaseModel):
|
|
@@ -415,13 +435,7 @@ class DataTransformConfig(BaseConfig):
|
|
|
415
435
|
def _validate_layers(self) -> "DataTransformConfig":
|
|
416
436
|
read_is_dlo = isinstance(self.permissions.read, DloPermission)
|
|
417
437
|
write_is_dlo = isinstance(self.permissions.write, DloPermission)
|
|
418
|
-
if
|
|
419
|
-
if not write_is_dlo:
|
|
420
|
-
raise ValueError(
|
|
421
|
-
"A streaming transform must write to a DLO "
|
|
422
|
-
"(permissions.write must be a 'dlo' entry)."
|
|
423
|
-
)
|
|
424
|
-
elif read_is_dlo != write_is_dlo:
|
|
438
|
+
if read_is_dlo != write_is_dlo:
|
|
425
439
|
raise ValueError(
|
|
426
440
|
"permissions.read and permissions.write must both reference "
|
|
427
441
|
"DLOs or both reference DMOs (got "
|
|
@@ -630,12 +644,15 @@ def zip(
|
|
|
630
644
|
logger.debug(f"Zipping directory... {directory}")
|
|
631
645
|
|
|
632
646
|
with zipfile.ZipFile(ZIP_FILE_NAME, "w", zipfile.ZIP_DEFLATED) as zipf:
|
|
633
|
-
for root, dirs, files in os.walk(directory):
|
|
634
|
-
# Skip .DS_Store and local credentials.
|
|
647
|
+
for root, dirs, files in os.walk(directory, followlinks=False):
|
|
648
|
+
# Skip symlinks, .DS_Store and local credentials.
|
|
635
649
|
for file in files:
|
|
650
|
+
abs_path = os.path.join(root, file)
|
|
651
|
+
arcname = os.path.relpath(abs_path, directory)
|
|
652
|
+
if os.path.islink(abs_path):
|
|
653
|
+
logger.warning(f"Skipping symlink file {arcname}")
|
|
654
|
+
continue
|
|
636
655
|
if file not in EXCLUDED_FILES:
|
|
637
|
-
abs_path = os.path.join(root, file)
|
|
638
|
-
arcname = os.path.relpath(abs_path, directory)
|
|
639
656
|
zipf.write(abs_path, arcname)
|
|
640
657
|
|
|
641
658
|
logger.debug(f"Created zip file: {ZIP_FILE_NAME}")
|
|
@@ -87,7 +87,7 @@ class BaseDataCloudWriter(BaseDataAccessLayer):
|
|
|
87
87
|
Args:
|
|
88
88
|
name: Target Data Lake Object name.
|
|
89
89
|
dataframe: Streaming PySpark DataFrame produced from a
|
|
90
|
-
``read_dlo_deltas``
|
|
90
|
+
``read_dlo_deltas`` source.
|
|
91
91
|
|
|
92
92
|
Returns:
|
|
93
93
|
The started ``StreamingQuery``; the caller drives its lifecycle
|
|
@@ -102,3 +102,35 @@ class BaseDataCloudWriter(BaseDataAccessLayer):
|
|
|
102
102
|
"streaming runtime; the local writer does not support streaming "
|
|
103
103
|
"deltas."
|
|
104
104
|
)
|
|
105
|
+
|
|
106
|
+
def write_dmo_deltas(
|
|
107
|
+
self, name: str, dataframe: PySparkDataFrame
|
|
108
|
+
) -> StreamingQuery:
|
|
109
|
+
"""Write a streaming DataFrame of deltas to a Data Model Object.
|
|
110
|
+
|
|
111
|
+
Streaming counterpart to :meth:`write_to_dmo`. Starts a streaming query
|
|
112
|
+
that writes each micro-batch to the target DMO via the Data Cloud
|
|
113
|
+
streaming sink and returns the resulting ``StreamingQuery`` handle. The
|
|
114
|
+
runtime owns the trigger and checkpoint location; callers pass only the
|
|
115
|
+
table name. Concrete streaming behavior is provided by the deployed
|
|
116
|
+
Data Cloud runtime; the base implementation raises
|
|
117
|
+
:class:`NotImplementedError`.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
name: Target Data Model Object name.
|
|
121
|
+
dataframe: Streaming PySpark DataFrame produced from a
|
|
122
|
+
``read_dmo_deltas`` source.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
The started ``StreamingQuery``; the caller drives its lifecycle
|
|
126
|
+
(typically ``query.awaitTermination()``).
|
|
127
|
+
|
|
128
|
+
Raises:
|
|
129
|
+
NotImplementedError: If the active writer does not support streaming
|
|
130
|
+
deltas (e.g. the local development writers).
|
|
131
|
+
"""
|
|
132
|
+
raise NotImplementedError(
|
|
133
|
+
"write_dmo_deltas is only supported when running in the Data Cloud "
|
|
134
|
+
"streaming runtime; the local writer does not support streaming "
|
|
135
|
+
"deltas."
|
|
136
|
+
)
|
|
@@ -34,7 +34,7 @@ from datacustomcode.version import get_version
|
|
|
34
34
|
|
|
35
35
|
DATA_ACCESS_METHODS = ["read_dlo", "read_dmo", "write_to_dlo", "write_to_dmo"]
|
|
36
36
|
STREAMING_READ_METHODS = ["read_dlo_deltas", "read_dmo_deltas"]
|
|
37
|
-
STREAMING_WRITE_METHODS = ["write_dlo_deltas"]
|
|
37
|
+
STREAMING_WRITE_METHODS = ["write_dlo_deltas", "write_dmo_deltas"]
|
|
38
38
|
|
|
39
39
|
DATA_TRANSFORM_CONFIG_TEMPLATE = {
|
|
40
40
|
"sdkVersion": get_version(),
|
|
@@ -181,6 +181,7 @@ class StreamingDataAccessLayerCalls(pydantic.BaseModel):
|
|
|
181
181
|
read_dlo_deltas: bool
|
|
182
182
|
read_dmo_deltas: bool
|
|
183
183
|
write_dlo_deltas: frozenset[str]
|
|
184
|
+
write_dmo_deltas: frozenset[str]
|
|
184
185
|
|
|
185
186
|
@pydantic.model_validator(mode="after")
|
|
186
187
|
def validate_access_layer(self) -> StreamingDataAccessLayerCalls:
|
|
@@ -193,10 +194,19 @@ class StreamingDataAccessLayerCalls(pydantic.BaseModel):
|
|
|
193
194
|
"A streaming transform must read from at least one DLO or DMO "
|
|
194
195
|
"delta stream (read_dlo_deltas / read_dmo_deltas)."
|
|
195
196
|
)
|
|
196
|
-
if not self.write_dlo_deltas:
|
|
197
|
+
if not self.write_dlo_deltas and not self.write_dmo_deltas:
|
|
197
198
|
raise ValueError(
|
|
198
|
-
"A streaming transform must write to at least one DLO
|
|
199
|
-
"write_dlo_deltas."
|
|
199
|
+
"A streaming transform must write to at least one DLO or DMO "
|
|
200
|
+
"via write_dlo_deltas / write_dmo_deltas."
|
|
201
|
+
)
|
|
202
|
+
if self.write_dlo_deltas and self.write_dmo_deltas:
|
|
203
|
+
raise ValueError(
|
|
204
|
+
"Cannot write DLO and DMO deltas in the same streaming transform."
|
|
205
|
+
)
|
|
206
|
+
if self.read_layer != self.write_layer:
|
|
207
|
+
raise ValueError(
|
|
208
|
+
"A streaming transform must read and write the same layer "
|
|
209
|
+
f"(got read={self.read_layer}, write={self.write_layer})."
|
|
200
210
|
)
|
|
201
211
|
return self
|
|
202
212
|
|
|
@@ -205,6 +215,11 @@ class StreamingDataAccessLayerCalls(pydantic.BaseModel):
|
|
|
205
215
|
"""Return the read source layer, ``"dlo"`` or ``"dmo"``."""
|
|
206
216
|
return "dlo" if self.read_dlo_deltas else "dmo"
|
|
207
217
|
|
|
218
|
+
@property
|
|
219
|
+
def write_layer(self) -> str:
|
|
220
|
+
"""Return the write target layer, ``"dlo"`` or ``"dmo"``."""
|
|
221
|
+
return "dlo" if self.write_dlo_deltas else "dmo"
|
|
222
|
+
|
|
208
223
|
|
|
209
224
|
class ClientMethodVisitor(ast.NodeVisitor):
|
|
210
225
|
"""AST Visitor that finds all instances of Client read/write method calls."""
|
|
@@ -217,6 +232,7 @@ class ClientMethodVisitor(ast.NodeVisitor):
|
|
|
217
232
|
self._read_dlo_deltas: bool = False
|
|
218
233
|
self._read_dmo_deltas: bool = False
|
|
219
234
|
self._write_dlo_deltas_instances: set[str] = set()
|
|
235
|
+
self._write_dmo_deltas_instances: set[str] = set()
|
|
220
236
|
self.variable_values: Dict[str, Union[str, None]] = {}
|
|
221
237
|
|
|
222
238
|
def visit_Assign(self, node: ast.Assign) -> None:
|
|
@@ -261,6 +277,8 @@ class ClientMethodVisitor(ast.NodeVisitor):
|
|
|
261
277
|
name = self._resolve_name_arg(node.args[0])
|
|
262
278
|
if name and method_name == "write_dlo_deltas":
|
|
263
279
|
self._write_dlo_deltas_instances.add(name)
|
|
280
|
+
elif name and method_name == "write_dmo_deltas":
|
|
281
|
+
self._write_dmo_deltas_instances.add(name)
|
|
264
282
|
self.generic_visit(node)
|
|
265
283
|
|
|
266
284
|
def _resolve_name_arg(self, arg: ast.expr) -> Union[str, None]:
|
|
@@ -278,6 +296,7 @@ class ClientMethodVisitor(ast.NodeVisitor):
|
|
|
278
296
|
self._read_dlo_deltas
|
|
279
297
|
or self._read_dmo_deltas
|
|
280
298
|
or bool(self._write_dlo_deltas_instances)
|
|
299
|
+
or bool(self._write_dmo_deltas_instances)
|
|
281
300
|
)
|
|
282
301
|
|
|
283
302
|
def found(self) -> DataAccessLayerCalls:
|
|
@@ -293,6 +312,7 @@ class ClientMethodVisitor(ast.NodeVisitor):
|
|
|
293
312
|
read_dlo_deltas=self._read_dlo_deltas,
|
|
294
313
|
read_dmo_deltas=self._read_dmo_deltas,
|
|
295
314
|
write_dlo_deltas=frozenset(self._write_dlo_deltas_instances),
|
|
315
|
+
write_dmo_deltas=frozenset(self._write_dmo_deltas_instances),
|
|
296
316
|
)
|
|
297
317
|
|
|
298
318
|
|
|
@@ -516,10 +536,10 @@ def _update_streaming_config(existing_config: dict[str, Any], file_path: str) ->
|
|
|
516
536
|
)
|
|
517
537
|
|
|
518
538
|
read_names = [source_name] if source_name else []
|
|
519
|
-
write_names = list(output.write_dlo_deltas)
|
|
539
|
+
write_names = list(output.write_dlo_deltas or output.write_dmo_deltas)
|
|
520
540
|
existing_config["permissions"] = {
|
|
521
541
|
"read": {read_layer: read_names},
|
|
522
|
-
"write": {
|
|
542
|
+
"write": {output.write_layer: write_names},
|
|
523
543
|
}
|
|
524
544
|
|
|
525
545
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"input": [
|
|
3
|
+
{
|
|
4
|
+
"text": "Online Remittance Instructions",
|
|
5
|
+
"metadata": {
|
|
6
|
+
"type": "text",
|
|
7
|
+
"page_number": 1,
|
|
8
|
+
"transcript_fields": {
|
|
9
|
+
"speaker": "Agent",
|
|
10
|
+
"start_timestamp": 1.0,
|
|
11
|
+
"end_timestamp": 8.75
|
|
12
|
+
},
|
|
13
|
+
"text_as_html": "<p>Online Remittance Instructions</p>",
|
|
14
|
+
"source_dmo_fields": {
|
|
15
|
+
"FilePath__c": "quarterly_report.pdf",
|
|
16
|
+
"Size__c": 1377454.0,
|
|
17
|
+
"ContentType__c": "pdf",
|
|
18
|
+
"LastModified__c": "2026-03-25T02:01:24.918000"
|
|
19
|
+
},
|
|
20
|
+
"prepend": [
|
|
21
|
+
{
|
|
22
|
+
"dmo_name": "udmo_1__dlm",
|
|
23
|
+
"field_name": "ResolvedFilePath__c",
|
|
24
|
+
"value": "udlo_1__dll:quarterly_report.pdf"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"image_base64": "sample_image_base64",
|
|
28
|
+
"image_mime_type": "image/png",
|
|
29
|
+
"image_type": "diagram"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|