pydataframer-databricks 0.1.0__py3-none-any.whl → 0.1.1__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.
- pydataframer_databricks/connectors.py +11 -8
- pydataframer_databricks-0.1.1.dist-info/METADATA +46 -0
- pydataframer_databricks-0.1.1.dist-info/RECORD +5 -0
- pydataframer_databricks-0.1.0.dist-info/METADATA +0 -43
- pydataframer_databricks-0.1.0.dist-info/RECORD +0 -5
- {pydataframer_databricks-0.1.0.dist-info → pydataframer_databricks-0.1.1.dist-info}/WHEEL +0 -0
|
@@ -33,7 +33,7 @@ class DatabricksConnector:
|
|
|
33
33
|
|
|
34
34
|
Examples
|
|
35
35
|
--------
|
|
36
|
-
>>> databricks_connector = DatabricksConnector(dbutils)
|
|
36
|
+
>>> databricks_connector = DatabricksConnector(dbutils, scope="dataframer")
|
|
37
37
|
>>> df = databricks_connector.fetch_sample_data(
|
|
38
38
|
... num_items_to_select=25,
|
|
39
39
|
... table_name="samples.bakehouse.media_customer_reviews"
|
|
@@ -41,7 +41,7 @@ class DatabricksConnector:
|
|
|
41
41
|
>>> df.head()
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
|
-
def __init__(self, dbutils):
|
|
44
|
+
def __init__(self, dbutils, scope):
|
|
45
45
|
"""
|
|
46
46
|
Initialize the Databricks connector.
|
|
47
47
|
|
|
@@ -49,8 +49,11 @@ class DatabricksConnector:
|
|
|
49
49
|
----------
|
|
50
50
|
dbutils : DBUtils
|
|
51
51
|
The dbutils object from your Databricks notebook context.
|
|
52
|
+
scope : str
|
|
53
|
+
The Databricks secret scope name containing connection credentials.
|
|
52
54
|
"""
|
|
53
55
|
self.dbutils = dbutils
|
|
56
|
+
self.scope = scope
|
|
54
57
|
|
|
55
58
|
def get_connection(self):
|
|
56
59
|
"""
|
|
@@ -64,14 +67,14 @@ class DatabricksConnector:
|
|
|
64
67
|
from databricks import sql
|
|
65
68
|
from databricks.sdk.core import Config, oauth_service_principal
|
|
66
69
|
|
|
67
|
-
server_hostname = self.dbutils.secrets.get(
|
|
68
|
-
http_path = self.dbutils.secrets.get(
|
|
70
|
+
server_hostname = self.dbutils.secrets.get(self.scope, "DATABRICKS_SERVER_HOSTNAME")
|
|
71
|
+
http_path = self.dbutils.secrets.get(self.scope, "DATABRICKS_HTTP_PATH")
|
|
69
72
|
|
|
70
73
|
def credential_provider():
|
|
71
74
|
config = Config(
|
|
72
75
|
host=f"https://{server_hostname}",
|
|
73
|
-
client_id=self.dbutils.secrets.get(
|
|
74
|
-
client_secret=self.dbutils.secrets.get(
|
|
76
|
+
client_id=self.dbutils.secrets.get(self.scope, "DATABRICKS_CLIENT_ID"),
|
|
77
|
+
client_secret=self.dbutils.secrets.get(self.scope, "DATABRICKS_CLIENT_SECRET"),
|
|
75
78
|
)
|
|
76
79
|
return oauth_service_principal(config)
|
|
77
80
|
|
|
@@ -100,7 +103,7 @@ class DatabricksConnector:
|
|
|
100
103
|
|
|
101
104
|
Examples
|
|
102
105
|
--------
|
|
103
|
-
>>> databricks_connector = DatabricksConnector(dbutils)
|
|
106
|
+
>>> databricks_connector = DatabricksConnector(dbutils, scope="dataframer")
|
|
104
107
|
>>> df = databricks_connector.fetch_sample_data(
|
|
105
108
|
... num_items_to_select=25,
|
|
106
109
|
... table_name="samples.bakehouse.media_customer_reviews"
|
|
@@ -146,7 +149,7 @@ class DatabricksConnector:
|
|
|
146
149
|
|
|
147
150
|
Examples
|
|
148
151
|
--------
|
|
149
|
-
>>> databricks_connector = DatabricksConnector(dbutils)
|
|
152
|
+
>>> databricks_connector = DatabricksConnector(dbutils, scope="dataframer")
|
|
150
153
|
>>> with open("samples.zip", "rb") as f:
|
|
151
154
|
... databricks_connector.load_generated_data(
|
|
152
155
|
... table_name="my_catalog.my_schema.my_table",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pydataframer-databricks
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Databricks connector for Dataframer
|
|
5
|
+
Author-email: Dataframer <info@dataframer.ai>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Requires-Dist: databricks-sdk>=0.81.0
|
|
9
|
+
Requires-Dist: databricks-sql-connector>=4.2.4
|
|
10
|
+
Requires-Dist: pandas>=2.0.0
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# pydataframer-databricks
|
|
17
|
+
|
|
18
|
+
Databricks connector for Dataframer
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install pydataframer-databricks
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from pydataframer_databricks import DatabricksConnector, DatasetType, FileType
|
|
30
|
+
|
|
31
|
+
databricks_connector = DatabricksConnector(dbutils, scope="dataframer")
|
|
32
|
+
|
|
33
|
+
# Fetch sample data
|
|
34
|
+
df = databricks_connector.fetch_sample_data(
|
|
35
|
+
num_items_to_select=100,
|
|
36
|
+
table_name="catalog.schema.table"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Load generated data
|
|
40
|
+
databricks_connector.load_generated_data(
|
|
41
|
+
table_name="catalog.schema.table",
|
|
42
|
+
downloaded_zip=downloaded_zip,
|
|
43
|
+
dataset_type=DatasetType.SINGLE_FILE,
|
|
44
|
+
file_type=FileType.CSV
|
|
45
|
+
)
|
|
46
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
pydataframer_databricks/__init__.py,sha256=piRrFtKpGGc2ctFDnMNblp5Whp6froRKXNeYkHnrw_o,214
|
|
2
|
+
pydataframer_databricks/connectors.py,sha256=efzhUrls_ns0_rwSjXi4n8w_Adcez7cJt5VJT7qHc2Q,9377
|
|
3
|
+
pydataframer_databricks-0.1.1.dist-info/METADATA,sha256=7g23DdCJraqZQkWWemWlA3s8jmGM2nCmoDmWNZi6560,1113
|
|
4
|
+
pydataframer_databricks-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
+
pydataframer_databricks-0.1.1.dist-info/RECORD,,
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: pydataframer-databricks
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Databricks connector for Dataframer
|
|
5
|
-
Author-email: Dataframer <info@dataframer.ai>
|
|
6
|
-
License: MIT
|
|
7
|
-
Requires-Python: >=3.9
|
|
8
|
-
Requires-Dist: databricks-sdk>=0.81.0
|
|
9
|
-
Requires-Dist: databricks-sql-connector>=4.2.4
|
|
10
|
-
Requires-Dist: pandas>=2.0.0
|
|
11
|
-
Provides-Extra: dev
|
|
12
|
-
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
13
|
-
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
|
|
16
|
-
# pydataframer-databricks
|
|
17
|
-
|
|
18
|
-
Databricks connector package for Dataframer, providing seamless integration with Databricks SQL and data operations.
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
pip install pydataframer-databricks
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Building
|
|
27
|
-
|
|
28
|
-
Requires [uv](https://docs.astral.sh/uv/) installed in your environment.
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
uv build
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Development
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Install with dev dependencies
|
|
38
|
-
uv pip install -e ".[dev]"
|
|
39
|
-
|
|
40
|
-
# Run tests
|
|
41
|
-
pytest
|
|
42
|
-
```
|
|
43
|
-
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
pydataframer_databricks/__init__.py,sha256=piRrFtKpGGc2ctFDnMNblp5Whp6froRKXNeYkHnrw_o,214
|
|
2
|
-
pydataframer_databricks/connectors.py,sha256=E4RlU30ADp0V27tuHWOai-7CM1YvmTInS_YonUpWMds,9191
|
|
3
|
-
pydataframer_databricks-0.1.0.dist-info/METADATA,sha256=L-5a9ThsJYq_CTeAI22Zlo269NoXH3jRtyFOW_dPxAQ,891
|
|
4
|
-
pydataframer_databricks-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
-
pydataframer_databricks-0.1.0.dist-info/RECORD,,
|
|
File without changes
|