lakeflow-fxmacrodata 0.1.0__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.
@@ -0,0 +1,7 @@
1
+ from databricks.labs.community_connector.sparkpds import LakeflowSource
2
+ from .fxmacrodata import FXMacroDataLakeflowConnect
3
+
4
+ class FXMacroDataDataSource(LakeflowSource):
5
+ _lakeflow_connect_cls = FXMacroDataLakeflowConnect
6
+
7
+ __all__ = ["FXMacroDataLakeflowConnect", "FXMacroDataDataSource"]
@@ -0,0 +1,66 @@
1
+ """Native Lakeflow snapshot ingestion of documented FXMacroData operations."""
2
+ import json
3
+ import re
4
+ from databricks.labs.community_connector.interface.lakeflow_connect import LakeflowConnect
5
+ from pyspark.sql.types import DoubleType, StringType, StructField, StructType
6
+ from fxmacrodata_platform_core import COLUMNS, IntegrationError, read, schemas, validate_request
7
+
8
+ _FRAMEWORK_OPTIONS = {"externalOptionsAllowList", "sourceName", "tableName", "tableNameList",
9
+ "tableConfigs", "isDeleteFlow", "namespacePrefix", "namespace"}
10
+ _SOURCE_OPTIONS = {"api_key_env", "arguments", "max_pages", "complete_history"}
11
+
12
+ class FXMacroDataLakeflowConnect(LakeflowConnect):
13
+ def __init__(self, options: dict[str, str]):
14
+ if set(options) - (_FRAMEWORK_OPTIONS | _SOURCE_OPTIONS):
15
+ raise IntegrationError("Use only documented connection options and a runtime secret reference.")
16
+ env = options.get("api_key_env") or None
17
+ if env is not None and not re.fullmatch(r"[A-Z][A-Z0-9_]{0,127}", env):
18
+ raise IntegrationError("API-key option must name an environment variable.")
19
+ super().__init__(dict(options))
20
+ self.api_key_env = env
21
+
22
+ def list_tables(self) -> list[str]:
23
+ return ["operation_catalog", *sorted(schemas())]
24
+
25
+ def get_table_schema(self, table_name, table_options):
26
+ self._options(table_name, table_options)
27
+ if table_name == "operation_catalog":
28
+ return StructType([StructField("operation", StringType(), False),
29
+ StructField("input_schema_json", StringType(), False)])
30
+ return StructType([StructField(name, DoubleType() if name == "value" else StringType(), True)
31
+ for name in COLUMNS])
32
+
33
+ def read_table_metadata(self, table_name, table_options):
34
+ self._options(table_name, table_options)
35
+ return {"primary_keys": ["operation"] if table_name == "operation_catalog" else ["record_id"],
36
+ "cursor_field": None, "ingestion_type": "snapshot"}
37
+
38
+ def _options(self, table_name, table_options):
39
+ if table_name not in self.list_tables():
40
+ raise IntegrationError("Unknown table; use list_tables().")
41
+ if set(table_options) - (_FRAMEWORK_OPTIONS | _SOURCE_OPTIONS):
42
+ raise IntegrationError("Unsupported table option.")
43
+ try:
44
+ args = json.loads(table_options.get("arguments", "{}"))
45
+ pages = int(table_options.get("max_pages", "1000"))
46
+ except (TypeError, ValueError):
47
+ raise IntegrationError("Use a JSON arguments object and integer page budget.") from None
48
+ history = table_options.get("complete_history", "true")
49
+ if not 1 <= pages <= 10000 or history not in {"true", "false"}:
50
+ raise IntegrationError("Invalid history mode or page budget.")
51
+ if table_name != "operation_catalog":
52
+ args = validate_request(table_name, args)
53
+ elif args:
54
+ raise IntegrationError("Operation catalogue does not accept arguments.")
55
+ return args, pages, history == "true"
56
+
57
+ def read_table(self, table_name, start_offset, table_options):
58
+ args, pages, history = self._options(table_name, table_options)
59
+ if table_name == "operation_catalog":
60
+ rows = [{"operation": name, "input_schema_json": json.dumps(schema, sort_keys=True)}
61
+ for name, schema in sorted(schemas().items())]
62
+ else:
63
+ rows = read(table_name, args, api_key_env=self.api_key_env,
64
+ complete_history=history, max_pages=pages).rows()
65
+ # None is the framework contract for a complete snapshot without an incremental offset.
66
+ return iter(rows), None
@@ -0,0 +1,8 @@
1
+ display_name: FXMacroData
2
+ connection:
3
+ parameters:
4
+ - name: api_key_env
5
+ type: string
6
+ required: false
7
+ description: Environment-variable name containing the customer's API key on the ingestion runtime. Leave empty for anonymous USD access.
8
+ external_options_allowlist: "arguments,max_pages,complete_history"
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.4
2
+ Name: lakeflow-fxmacrodata
3
+ Version: 0.1.0
4
+ Summary: FXMacroData custom connector for Databricks Lakeflow Connect
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Robert Tidball
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Homepage, https://fxmacrodata.com/?utm_source=pypi&utm_medium=referral&utm_campaign=lakeflow-fxmacrodata&utm_content=homepage
28
+ Project-URL: Documentation, https://fxmacrodata.com/documentation/reference?utm_source=pypi&utm_medium=referral&utm_campaign=lakeflow-fxmacrodata&utm_content=package
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: fxmacrodata-platform-core==0.1.0
33
+ Requires-Dist: lakeflow-community-connectors<1,>=0.1.0
34
+ Dynamic: license-file
35
+
36
+ # FXMacroData for Databricks Lakeflow Connect
37
+
38
+ Install this wheel as a workspace library alongside the Lakeflow Community Connectors framework. Its public client and platform core dependencies resolve from PyPI. Build the framework wheel from the official repository using Databricks' documented custom-connector procedure; do not assume it is available on PyPI. The framework interface used here is version 0.1.0 at [revision fc69fe7907f640e5283da40d4df0004db73c850b](https://github.com/databrickslabs/lakeflow-community-connectors/tree/fc69fe7907f640e5283da40d4df0004db73c850b). Install the framework wheel and adapter wheel together so the dependency resolver can find the source-built framework. PySpark is supplied by the Databricks runtime. This is a native `LakeflowConnect` implementation and `LakeflowSource` Spark data source.
39
+
40
+ ```python
41
+ from databricks.labs.community_connector.sources.fxmacrodata import FXMacroDataDataSource
42
+ spark.dataSource.register(FXMacroDataDataSource)
43
+ ```
44
+
45
+ For the Add data custom connector tile, use source name `fxmacrodata`, display name `FXMacroData`, the supplied connector specification, and the framework/client/core/connector wheel libraries from a Unity Catalog volume. Follow [Databricks custom connector setup](https://docs.databricks.com/aws/en/ingestion/custom-connectors). A Unity Catalog workspace and compatible Lakeflow runtime are required.
46
+
47
+ The source archive includes `connector_spec.yaml`. The wheel also installs it
48
+ under `share/lakeflow-fxmacrodata` within the library environment, for use when
49
+ configuring the custom connector tile. Install framework and adapter wheels in
50
+ the same environment so their Databricks package directories are colocated.
51
+
52
+ Discover the `operation_catalog` table to find all 33 REST operations and 54 MCP tools. Each operation is a table; configure its `arguments` option with a JSON object matching the catalogue schema. For example, table `release_calendar` accepts `{"currency":"usd"}`. Table `indicator_history` accepts `{"currency":"usd","indicator":"policy_rate","value_mode":"source"}`. Keep values and revisions in `record_json` and access, provenance, units and publication evidence in `response_json`.
53
+
54
+ The connector uses full snapshot refreshes because historical data can revise. It declares snapshot ingestion and returns no incremental offset; it does not infer change-data-capture or deletion events. Offset and calendar cursor histories have explicit page budgets. Set `complete_history=false` to request one page or bounded feed call. An exhausted budget fails the read rather than returning an apparently complete snapshot.
55
+
56
+ Leave `api_key_env` empty for anonymous access. To use paid access, arrange for the named variable to be available in the ingestion runtime through your workspace's secret-backed environment configuration. Put the variable name in the connection specification; never put the key in arguments, notebooks or connection options. Serverless environments that cannot supply this variable can use anonymous access; provision a compatible secret-backed runtime for protected data.
57
+
58
+ Anonymous USD data has the API's published delay and history limits. Other datasets require the appropriate subscription. Loading data into your workspace does not grant redistribution rights. This package supplies the custom connector; it is not a Databricks-managed connector or Marketplace listing.
@@ -0,0 +1,8 @@
1
+ databricks/labs/community_connector/sources/fxmacrodata/__init__.py,sha256=6lsxnXhC74sD1kfKH8HFbQ7_AKxtmbJ5jLAk1hvbv2g,299
2
+ databricks/labs/community_connector/sources/fxmacrodata/fxmacrodata.py,sha256=7WRLTC38oLe5IV69-5giqilC4fsEYRoU-Ru-vkFbRE0,3804
3
+ lakeflow_fxmacrodata-0.1.0.data/data/share/lakeflow-fxmacrodata/connector_spec.yaml,sha256=slOYdzRX6dj1yQmZxWGEofQKMBLAfvh4UIz3omnhdVg,335
4
+ lakeflow_fxmacrodata-0.1.0.dist-info/licenses/LICENSE,sha256=rklK7Fl8aL1eWGubsrozZ7rCNTsN-MATw4M6LQIMv10,1092
5
+ lakeflow_fxmacrodata-0.1.0.dist-info/METADATA,sha256=W3Z3sgxKJe-XoM8ORcqaPB8qfMguyDwirPaYlSNcwbE,5363
6
+ lakeflow_fxmacrodata-0.1.0.dist-info/WHEEL,sha256=16fc_9Rp854SLcdhaDEjr0u65p0e3FhZxihNgcnCE98,91
7
+ lakeflow_fxmacrodata-0.1.0.dist-info/top_level.txt,sha256=7kRdatoSgU0EUurRQJ_3F1Nv4EOSHWAr6ng25tJOJKU,11
8
+ lakeflow_fxmacrodata-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Robert Tidball
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ databricks