supaflow-python-sdk 1.0.74__py3-none-any.whl
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.
- supaflow_python_sdk/__init__.py +150 -0
- supaflow_python_sdk/_definition_validation.py +220 -0
- supaflow_python_sdk/_legacy_manifest.py +89 -0
- supaflow_python_sdk/_legacy_naming.py +50 -0
- supaflow_python_sdk/_precision_json.py +74 -0
- supaflow_python_sdk/base_connector.py +146 -0
- supaflow_python_sdk/capabilities.py +74 -0
- supaflow_python_sdk/catalog_naming.py +189 -0
- supaflow_python_sdk/child_settings.py +44 -0
- supaflow_python_sdk/compatibility.json +10 -0
- supaflow_python_sdk/connector_definition.py +279 -0
- supaflow_python_sdk/connector_fixture.py +13 -0
- supaflow_python_sdk/connector_identity.py +55 -0
- supaflow_python_sdk/connector_property.py +97 -0
- supaflow_python_sdk/connector_resource.py +388 -0
- supaflow_python_sdk/csv_record_emitter.py +288 -0
- supaflow_python_sdk/cursor_candidates.py +167 -0
- supaflow_python_sdk/errors.py +130 -0
- supaflow_python_sdk/field_capabilities.py +50 -0
- supaflow_python_sdk/helpers.py +98 -0
- supaflow_python_sdk/host_api.py +102 -0
- supaflow_python_sdk/job_context.py +39 -0
- supaflow_python_sdk/jsonl_record_emitter.py +727 -0
- supaflow_python_sdk/keyless_object_handling.py +19 -0
- supaflow_python_sdk/models.py +1052 -0
- supaflow_python_sdk/naming.py +267 -0
- supaflow_python_sdk/native_mapped_jsonl_record_emitter.py +180 -0
- supaflow_python_sdk/oauth.py +399 -0
- supaflow_python_sdk/openapi_schema_builder.py +778 -0
- supaflow_python_sdk/property_rules.py +27 -0
- supaflow_python_sdk/py.typed +0 -0
- supaflow_python_sdk/resource_options.py +9 -0
- supaflow_python_sdk/schema_compliance.py +481 -0
- supaflow_python_sdk/source.py +165 -0
- supaflow_python_sdk/source_namespace.py +325 -0
- supaflow_python_sdk/supa_id.py +422 -0
- supaflow_python_sdk/temporal_stage_value.py +136 -0
- supaflow_python_sdk/type_inference.py +583 -0
- supaflow_python_sdk/ui.py +45 -0
- supaflow_python_sdk/write_plan.py +112 -0
- supaflow_python_sdk-1.0.74.dist-info/METADATA +80 -0
- supaflow_python_sdk-1.0.74.dist-info/RECORD +44 -0
- supaflow_python_sdk-1.0.74.dist-info/WHEEL +5 -0
- supaflow_python_sdk-1.0.74.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Python write-plan dataclasses mirroring Java supaflow-core/writeplan/.
|
|
2
|
+
|
|
3
|
+
These are the public contract types consumed by JsonlRecordEmitter and
|
|
4
|
+
the dlt system-field enrichment helper. They are intentionally pure
|
|
5
|
+
dataclasses -- no runtime logic, no imports from the dlt layer.
|
|
6
|
+
|
|
7
|
+
See spec sections "Processor and Emitter Interfaces" (L405-499) and
|
|
8
|
+
"Mapped JSONL Writer" (L572-643).
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import enum
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SupaflowSystemField(str, enum.Enum):
|
|
18
|
+
"""Logical names of the _supa_* stage-table system columns.
|
|
19
|
+
|
|
20
|
+
Must stay in lockstep with supa_id.SUPA_SYSTEM_COLUMNS.
|
|
21
|
+
The parity test in test_write_plan_dataclasses.py enforces this.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
SUPA_SYNCED = "_supa_synced"
|
|
25
|
+
SUPA_DELETED = "_supa_deleted"
|
|
26
|
+
SUPA_INDEX = "_supa_index"
|
|
27
|
+
SUPA_ID = "_supa_id"
|
|
28
|
+
SUPA_JOB_ID = "_supa_job_id"
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def column_name(self) -> str:
|
|
32
|
+
"""The logical column name (lowercase, with leading underscore)."""
|
|
33
|
+
return self.value
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class RecordFieldBinding:
|
|
38
|
+
"""One source-to-target field binding inside a RecordWritePlan.
|
|
39
|
+
|
|
40
|
+
source_name: the key the connector record map uses (record.get(source_name)).
|
|
41
|
+
target_name: destination column name in metadata.
|
|
42
|
+
target_formatted_name: SQL identifier used in destination DDL/DML (may include quotes).
|
|
43
|
+
target_load_key: physical column name for name-based loaders such as
|
|
44
|
+
Snowflake MATCH_BY_COLUMN_NAME (must NOT include quotes).
|
|
45
|
+
source_field: MetadataField from the source schema.
|
|
46
|
+
target_field: MetadataField from the destination schema.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
ordinal: int
|
|
50
|
+
source_name: str
|
|
51
|
+
target_name: str
|
|
52
|
+
target_formatted_name: str | None
|
|
53
|
+
target_load_key: str
|
|
54
|
+
source_field: Any # MetadataField; typed as Any to avoid circular SDK import
|
|
55
|
+
target_field: Any # MetadataField
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass
|
|
59
|
+
class SystemFieldBinding:
|
|
60
|
+
"""One stage-table system-field binding inside a RecordWritePlan.
|
|
61
|
+
|
|
62
|
+
The writer encodes the value for field (e.g. _supa_id) under
|
|
63
|
+
target_load_key on every record.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
target_name: str
|
|
67
|
+
target_formatted_name: str | None
|
|
68
|
+
target_load_key: str
|
|
69
|
+
field: SupaflowSystemField
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass
|
|
73
|
+
class RecordWritePlan:
|
|
74
|
+
"""Source-to-target write plan handed to a mapped record writer.
|
|
75
|
+
|
|
76
|
+
Mirrors Java RecordWritePlan. The plan remains focused on data shape
|
|
77
|
+
and bindings; per-job values (sync_time, job_details_id) are NOT on
|
|
78
|
+
the plan -- they flow through the enrichment helper context.
|
|
79
|
+
|
|
80
|
+
file_format: e.g. "CSV", "JSON".
|
|
81
|
+
stage_format: e.g. "CSV", "JSONL".
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
source_output_metadata: Any # ObjectMetadata; typed Any to avoid circular import
|
|
85
|
+
target_output_metadata: Any # ObjectMetadata
|
|
86
|
+
fields: list[RecordFieldBinding] = field(default_factory=list)
|
|
87
|
+
system_fields: list[SystemFieldBinding] = field(default_factory=list)
|
|
88
|
+
file_format: str = "CSV"
|
|
89
|
+
stage_format: str = "CSV"
|
|
90
|
+
# Destination-declared upper bound for fractional-second digits in typed
|
|
91
|
+
# staged temporal values. None preserves the runtime's legacy bytes.
|
|
92
|
+
max_fractional_second_digits: int | None = None
|
|
93
|
+
# Mirrors Java RecordWritePlan.sourceAndTargetOrdinalsAligned. The Java
|
|
94
|
+
# planner sets this to true when source ordinal i maps to target ordinal i
|
|
95
|
+
# for every record-field binding -- a fast path some loaders use to skip
|
|
96
|
+
# per-row reordering. Default false so older Java payloads (without the
|
|
97
|
+
# field) fall back to the safe slow path on the Python side.
|
|
98
|
+
source_and_target_ordinals_aligned: bool = False
|
|
99
|
+
|
|
100
|
+
def __post_init__(self) -> None:
|
|
101
|
+
if (
|
|
102
|
+
self.max_fractional_second_digits is not None
|
|
103
|
+
and (
|
|
104
|
+
isinstance(self.max_fractional_second_digits, bool)
|
|
105
|
+
or not isinstance(self.max_fractional_second_digits, int)
|
|
106
|
+
or not 0 <= self.max_fractional_second_digits <= 9
|
|
107
|
+
)
|
|
108
|
+
):
|
|
109
|
+
raise ValueError(
|
|
110
|
+
"max_fractional_second_digits must be an integer between 0 and 9, got "
|
|
111
|
+
f"{self.max_fractional_second_digits!r}"
|
|
112
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: supaflow-python-sdk
|
|
3
|
+
Version: 1.0.74
|
|
4
|
+
Summary: Public Python SDK for building Supaflow connectors.
|
|
5
|
+
Author-email: Supaflow <support@supa-flow.io>
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Homepage, https://www.supa-flow.io
|
|
8
|
+
Project-URL: Documentation, https://www.supa-flow.io/docs
|
|
9
|
+
Keywords: supaflow,connectors,sdk,data-integration,etl
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: Database
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Supaflow Python SDK
|
|
23
|
+
|
|
24
|
+
`supaflow-python-sdk` is the official Python SDK for building [Supaflow](https://www.supa-flow.io) connectors.
|
|
25
|
+
|
|
26
|
+
It provides a typed base class and the request/response models a connector
|
|
27
|
+
implements, so the code you write can be run by the Supaflow platform to
|
|
28
|
+
discover schemas, stage data, and sync incrementally.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install supaflow-python-sdk
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python 3.11 or newer.
|
|
37
|
+
|
|
38
|
+
## Getting started
|
|
39
|
+
|
|
40
|
+
A connector subclasses `BaseConnector` and implements its lifecycle methods —
|
|
41
|
+
at minimum `init` and `stage`:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from supaflow_python_sdk import (
|
|
45
|
+
BaseConnector,
|
|
46
|
+
InitRequest,
|
|
47
|
+
InitResult,
|
|
48
|
+
StageRequest,
|
|
49
|
+
StageResult,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class MyConnector(BaseConnector):
|
|
54
|
+
def init(self, request: InitRequest) -> InitResult:
|
|
55
|
+
"""Validate configuration and credentials."""
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
def stage(self, request: StageRequest) -> StageResult:
|
|
59
|
+
"""Read records from the source and write them to staging."""
|
|
60
|
+
...
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`schema`, `read`, `load`, and `map_target_object` are available to override for
|
|
64
|
+
richer sources.
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
Connector-authoring guides and the full API reference are at
|
|
69
|
+
[supa-flow.io/docs](https://www.supa-flow.io/docs).
|
|
70
|
+
|
|
71
|
+
Repository contributors should use
|
|
72
|
+
[`DEPENDENCY_SCOPES.md`](DEPENDENCY_SCOPES.md) to decide whether a Python
|
|
73
|
+
dependency belongs to development tooling, the agent runtime, one connector,
|
|
74
|
+
or a remote Snowflake procedure. It also documents the reserved ownership path
|
|
75
|
+
for any future Python code that runs locally on behalf of the Snowflake
|
|
76
|
+
connector.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Proprietary. (c) Supaflow. See [supa-flow.io](https://www.supa-flow.io).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
supaflow_python_sdk/__init__.py,sha256=gqnHuVqdTKC79E3OR_TLovY2qqAQHTfJGSXFzx9cLhM,3738
|
|
2
|
+
supaflow_python_sdk/_definition_validation.py,sha256=iE9s9kImJwoO3pOQCpQLY5BPiRkMm6xPrQyed89cFLs,9974
|
|
3
|
+
supaflow_python_sdk/_legacy_manifest.py,sha256=aGLj1LkKD2tMKr6fdUvNxcP2c8Ez1or1ifzkiN9VLiE,3264
|
|
4
|
+
supaflow_python_sdk/_legacy_naming.py,sha256=z2Pea1RHsgwjrjS7i40O60V1taq5Hq5hjTlDWAToQf8,2143
|
|
5
|
+
supaflow_python_sdk/_precision_json.py,sha256=7Lo_j0Vu07r3HJljGXKMBw7oSJxCqmAoaU5mzA4irqs,2904
|
|
6
|
+
supaflow_python_sdk/base_connector.py,sha256=c8_EEq6G7PK1WvEr_jH38Psj9NQsV3O4y9xFw-IaI10,5669
|
|
7
|
+
supaflow_python_sdk/capabilities.py,sha256=GVYAHgi61Q5ihDOhqHbhFmBFOOq9bgxKBswmKniCCaM,4302
|
|
8
|
+
supaflow_python_sdk/catalog_naming.py,sha256=6MzkUtQtHMsWAEIIEqoAaUQb8j3goJ9C1Yh0_8QbapI,6630
|
|
9
|
+
supaflow_python_sdk/child_settings.py,sha256=RcH4kvKPEZwx4sO4sqbnF4YQd9dJd4pKR61UCDelrFE,1704
|
|
10
|
+
supaflow_python_sdk/compatibility.json,sha256=TzluVVtD1ZjZElNxqvlA433a2ZPAE8zsQ8D5tYOvJvM,180
|
|
11
|
+
supaflow_python_sdk/connector_definition.py,sha256=DwSXQxaxKkON8PO1_K_lkJRIITp1zokgmH20mVCV1C8,15189
|
|
12
|
+
supaflow_python_sdk/connector_fixture.py,sha256=mwJ4kRGCOks1ORV3LIO6vssvtOqnGsQMDIxMkVqiqI4,384
|
|
13
|
+
supaflow_python_sdk/connector_identity.py,sha256=wYtocabO_lRQ9nfVAICpAREjkDYXiyq-KlrhLO23EoE,2450
|
|
14
|
+
supaflow_python_sdk/connector_property.py,sha256=U7U3cZT6HRP6SzGXxzE15wDu2bFZI1brTAyWag7zm40,3783
|
|
15
|
+
supaflow_python_sdk/connector_resource.py,sha256=z9PDkapEa81aISXsHJiWTAhKi4GneVS9tpNxo6MD0Ww,18945
|
|
16
|
+
supaflow_python_sdk/csv_record_emitter.py,sha256=SIlEtdzjRg2Q9IHnML77vNXJE-xUoYIqd5-c1-flNsc,10763
|
|
17
|
+
supaflow_python_sdk/cursor_candidates.py,sha256=oBxydcdECbcJriPIhucfRb1HnOO53WxFsJlt2w-SKeM,5600
|
|
18
|
+
supaflow_python_sdk/errors.py,sha256=n7kOnP9io0ul4mWLkTNbA_DvLg-euvxvdOHLfj8I42o,3669
|
|
19
|
+
supaflow_python_sdk/field_capabilities.py,sha256=7993EPiAhDNHFxdEUiRzRjtzAMbTWTxrBrGVHmE05lw,1752
|
|
20
|
+
supaflow_python_sdk/helpers.py,sha256=buPw16RB6hDHONApZ1qWHR9xJ8GS5nkRCWbT7Pl_DP8,3337
|
|
21
|
+
supaflow_python_sdk/host_api.py,sha256=pEZyQ25xQVZJ1tbnlSsHREkF3Xx6M7Kgum7fc5qhMdA,4477
|
|
22
|
+
supaflow_python_sdk/job_context.py,sha256=fbe3gK3Lo5ffIdqFjQ9GfyRQBdmCzSZo-RDwI-LiIwM,1257
|
|
23
|
+
supaflow_python_sdk/jsonl_record_emitter.py,sha256=6LbSZpFLQ9SOjhF7dOBVh1LmhmrCG9YEQQeSN8IGoWk,27357
|
|
24
|
+
supaflow_python_sdk/keyless_object_handling.py,sha256=FT4fYi6XfYvjtiBh3r4RyhfS-E0IRLVPMeQVbt1k11o,547
|
|
25
|
+
supaflow_python_sdk/models.py,sha256=kEEHxtkqD_aeceUhAeUjyas1XoJY59VroLhn2ZtAXFc,41673
|
|
26
|
+
supaflow_python_sdk/naming.py,sha256=Zg3DXClzdYLSwL9wUYxvsDpYWGYISbTVttaE3Zdj5qQ,8873
|
|
27
|
+
supaflow_python_sdk/native_mapped_jsonl_record_emitter.py,sha256=ODtnSeSBbmxDhUdLpHnPqYM2iQZSBilWwC4gjq7YMkI,6762
|
|
28
|
+
supaflow_python_sdk/oauth.py,sha256=YeUsrlDEBTDCXIQXpG75TSMps-bJ3zo-CB5xYEJ93Qw,16723
|
|
29
|
+
supaflow_python_sdk/openapi_schema_builder.py,sha256=aFBi8FHeyN-u23TQr5OqEwz_f8nDF_N3NZzupE-3Ej4,32130
|
|
30
|
+
supaflow_python_sdk/property_rules.py,sha256=RacF3tTwek_-DUV4NdxAVcCWMgm6Nvp2n960nQkeuz4,794
|
|
31
|
+
supaflow_python_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
+
supaflow_python_sdk/resource_options.py,sha256=qpPXtQGKBBz-XXd3MEu-yJ6G9TdeaBlSS89GyQ1-Cc0,386
|
|
33
|
+
supaflow_python_sdk/schema_compliance.py,sha256=bFmwHyISA2n2CGf-iiZICJEDh26tMvWECb96vjBYJAo,22719
|
|
34
|
+
supaflow_python_sdk/source.py,sha256=peo7PprkpfPdNv3EtwOJr_Rg7Yvjppe03EueRSa08Es,4963
|
|
35
|
+
supaflow_python_sdk/source_namespace.py,sha256=tnVP76fTxrJAtWLySCbjvmCarehPEAb3GLFM0h5E-hQ,12870
|
|
36
|
+
supaflow_python_sdk/supa_id.py,sha256=uMq3-m1xdYcjRGeZ1Z98hq5vP68aug11TGjextA5qXo,16205
|
|
37
|
+
supaflow_python_sdk/temporal_stage_value.py,sha256=bqk4GWfjtVF5fpv24Z4OSy2gq204Gd8k1ypAPTmKntQ,4533
|
|
38
|
+
supaflow_python_sdk/type_inference.py,sha256=QA5tNWMu_VPiUMPbUJ0VFKnyeWYNSpbInPwmHlICx4k,21476
|
|
39
|
+
supaflow_python_sdk/ui.py,sha256=1u9MdFT7WeeFYe6VnUOblr3191BkhXxN1mBjX0mUR-Y,1343
|
|
40
|
+
supaflow_python_sdk/write_plan.py,sha256=PglTpTZOzvmxDOjkFLCb6X_q2DB9pWhu9DyM92jVmnY,4149
|
|
41
|
+
supaflow_python_sdk-1.0.74.dist-info/METADATA,sha256=SLpJIQpPIq1SNT570yLFzuMH7r4BHkRt2tC3tRLEJTE,2520
|
|
42
|
+
supaflow_python_sdk-1.0.74.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
43
|
+
supaflow_python_sdk-1.0.74.dist-info/top_level.txt,sha256=joZsuNU1WBQMeKjllCxCBbz_Clva_TnutR8rPFIikW8,20
|
|
44
|
+
supaflow_python_sdk-1.0.74.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
supaflow_python_sdk
|