atoti-client-directquery-databricks 0.9.3__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,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: atoti-client-directquery-databricks
3
+ Version: 0.9.3
4
+ Summary: Code to use DirectQuery on Databricks
5
+ Project-URL: Documentation, https://docs.atoti.io/0.9.3/api/atoti_directquery_databricks.html
6
+ Project-URL: Homepage, https://www.atoti.io
7
+ Project-URL: Issues, https://github.com/atoti/atoti/issues
8
+ Author-email: ActiveViam <dev@atoti.io>
9
+ Keywords: atoti,cloud,database,databricks,directquery
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: Free for non-commercial use
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: atoti-client==0.9.3
17
+ Requires-Dist: pydantic>=2.10.1
18
+ Requires-Dist: typing-extensions>=4.12.2
@@ -0,0 +1,7 @@
1
+ atoti_directquery_databricks/__init__.py,sha256=FTt0-BKSunvVeYPeoA_YiOeJckNopYvK5taPmNBvTl4,202
2
+ atoti_directquery_databricks/connection_config.py,sha256=wKgcomLOZzy3Yfke0cUmco6_x4_0-kV9OAsaBhRHgUg,5216
3
+ atoti_directquery_databricks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ atoti_directquery_databricks/table_config.py,sha256=7CadjwF-k-7tHYTagkWNDNE4yWF0gkIy94zPxphHZsc,525
5
+ atoti_client_directquery_databricks-0.9.3.dist-info/METADATA,sha256=JcE3bh6UVxB5b2iYWAd3PlY9xYa4wEAQDLQUG2XWtcs,766
6
+ atoti_client_directquery_databricks-0.9.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ atoti_client_directquery_databricks-0.9.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,4 @@
1
+ """Code to use DirectQuery with `Databricks <https://www.databricks.com>`__."""
2
+
3
+ from .connection_config import ConnectionConfig as ConnectionConfig
4
+ from .table_config import TableConfig as TableConfig
@@ -0,0 +1,151 @@
1
+ from typing import Literal, final
2
+
3
+ from atoti._pydantic import PYDANTIC_CONFIG as _PYDANTIC_CONFIG
4
+ from atoti.directquery._external_database_connection_config import (
5
+ AutoMultiColumnArrayConversionConfig,
6
+ ExternalDatabaseConnectionConfig,
7
+ PasswordConfig,
8
+ )
9
+ from pydantic.dataclasses import dataclass
10
+ from typing_extensions import override
11
+
12
+
13
+ @final
14
+ @dataclass(config=_PYDANTIC_CONFIG, frozen=True, kw_only=True)
15
+ class ConnectionConfig(
16
+ ExternalDatabaseConnectionConfig,
17
+ AutoMultiColumnArrayConversionConfig,
18
+ PasswordConfig,
19
+ ):
20
+ """Config to connect to a Databricks database.
21
+
22
+ :atoti_server_docs:`To aggregate native Databrick arrays, UDAFs (User Defined Aggregation Functions) provided by ActiveViam must be registered on the cluster <directquery/databases/databricks/#vectors-support>`.
23
+
24
+ Native array aggregation is not supported on SQL warehouses.
25
+
26
+ Example:
27
+ .. doctest::
28
+ :hide:
29
+
30
+ >>> session = getfixture("session_with_directquery_databricks_plugin")
31
+
32
+ >>> import os
33
+ >>> from atoti_directquery_databricks import ConnectionConfig
34
+ >>> connection_config = ConnectionConfig(
35
+ ... url="jdbc:databricks://"
36
+ ... + os.environ["DATABRICKS_SERVER_HOSTNAME"]
37
+ ... + "/default;"
38
+ ... + "transportMode=http;"
39
+ ... + "ssl=1;"
40
+ ... + "httpPath="
41
+ ... + os.environ["DATABRICKS_HTTP_PATH_CLUSTER_RUNTIME_15"]
42
+ ... + ";"
43
+ ... + "AuthMech=3;"
44
+ ... + "UID=token;"
45
+ ... + "EnableArrow=0;",
46
+ ... password=os.environ["DATABRICKS_AUTH_TOKEN"],
47
+ ... )
48
+ >>> external_database = session.connect_to_external_database(connection_config)
49
+
50
+ """
51
+
52
+ url: str
53
+ """The JDBC connection string."""
54
+
55
+ feeding_url: str | None = None
56
+ """When not ``None``, this JDBC connection string will be used instead of :attr:`url` for the feeding phases."""
57
+
58
+ time_travel: Literal[False, "lax", "strict"] = "strict"
59
+ """How to use Databricks' time travel feature.
60
+
61
+ Databricks does not support time travel with views, so the options are:
62
+
63
+ * ``False``: tables and views are queried on the latest state of the database.
64
+ * ``"lax"``: tables are queried with time travel but views are queried without it.
65
+ * ``"strict"``: tables are queried with time travel and querying a view raises an error.
66
+ """
67
+
68
+ array_sum_agg_function_name: str | None = None
69
+ """The name (if different from the default) of the UDAF performing :func:`atoti.agg.sum` on native arrays.
70
+
71
+ Note:
72
+ This function must be defined in Databricks and accessible to the role running the queries.
73
+ """
74
+
75
+ array_long_agg_function_name: str | None = None
76
+ """The name (if different from the default) of the UDAF performing :func:`atoti.agg.long` on native arrays.
77
+
78
+ Note:
79
+ This function must be defined in Databricks and accessible to the role running the queries.
80
+ """
81
+
82
+ array_short_agg_function_name: str | None = None
83
+ """The name (if different from the default) of the UDAF performing :func:`atoti.agg.short` on native arrays.
84
+
85
+ Note:
86
+ This function must be defined in Databricks and accessible to the role running the queries.
87
+ """
88
+
89
+ array_sum_product_agg_function_name: str | None = None
90
+ """The name (if different from the default) of the UDAF performing :func:`atoti.agg.sum_product` on native arrays.
91
+
92
+ Note:
93
+ This function must be defined in Databricks and accessible to the role running the queries.
94
+ """
95
+
96
+ @property
97
+ @override
98
+ def _database_key(self) -> str:
99
+ return "DATABRICKS"
100
+
101
+ @property
102
+ @override
103
+ def _options(self) -> dict[str, str]:
104
+ return {
105
+ **super()._options,
106
+ **self._auto_multi_array_conversion_options,
107
+ **(
108
+ {"FEEDING_CONNECTION_STRING": self.feeding_url}
109
+ if self.feeding_url
110
+ else {}
111
+ ),
112
+ **(
113
+ {
114
+ "SUM_VECTOR_FUNCTION_NAME": self.array_sum_agg_function_name,
115
+ }
116
+ if self.array_sum_agg_function_name
117
+ else {}
118
+ ),
119
+ **(
120
+ {
121
+ "LONG_VECTOR_FUNCTION_NAME": self.array_long_agg_function_name,
122
+ }
123
+ if self.array_long_agg_function_name
124
+ else {}
125
+ ),
126
+ **(
127
+ {
128
+ "SHORT_VECTOR_FUNCTION_NAME": self.array_short_agg_function_name,
129
+ }
130
+ if self.array_short_agg_function_name
131
+ else {}
132
+ ),
133
+ **(
134
+ {
135
+ "SUM_PRODUCT_VECTOR_FUNCTION_NAME": self.array_sum_product_agg_function_name,
136
+ }
137
+ if self.array_sum_product_agg_function_name
138
+ else {}
139
+ ),
140
+ "TIME_TRAVEL": self.time_travel.upper() if self.time_travel else "DISABLED",
141
+ }
142
+
143
+ @property
144
+ @override
145
+ def _password(self) -> str | None:
146
+ return self.password
147
+
148
+ @property
149
+ @override
150
+ def _url(self) -> str | None:
151
+ return self.url
File without changes
@@ -0,0 +1,19 @@
1
+ from typing import final
2
+
3
+ from atoti._pydantic import PYDANTIC_CONFIG as _PYDANTIC_CONFIG
4
+ from atoti.directquery._external_table_config import (
5
+ ArrayConversionConfig,
6
+ ExternalTableConfig,
7
+ )
8
+ from pydantic.dataclasses import dataclass
9
+
10
+ from .connection_config import ConnectionConfig
11
+
12
+
13
+ @final
14
+ @dataclass(config=_PYDANTIC_CONFIG, frozen=True, kw_only=True)
15
+ class TableConfig(
16
+ ExternalTableConfig[ConnectionConfig],
17
+ ArrayConversionConfig,
18
+ ):
19
+ """Config passed to :meth:`~atoti.Session.add_external_table`."""