databricks-modules-vy 1.1.23__tar.gz → 1.2.1__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.
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/PKG-INFO +1 -1
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/sharepoint.py +30 -2
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy.egg-info/PKG-INFO +1 -1
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/pyproject.toml +1 -1
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/LICENSE +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/__init__.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/data_product.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/data_quality_tests.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/dataframe.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/extend_class.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/glue.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/logging.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/oracle.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/qlik.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/s3.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/service_platform.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/snaplogic.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/styringsinfo_postgres.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/unity_catalog.py +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy.egg-info/SOURCES.txt +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy.egg-info/dependency_links.txt +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy.egg-info/top_level.txt +0 -0
- {databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/setup.cfg +0 -0
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/sharepoint.py
RENAMED
|
@@ -21,10 +21,17 @@ dbutils = DBUtils(spark)
|
|
|
21
21
|
def _get_sharepoint_ctx(site_name="VyMasterdata") -> ClientContext:
|
|
22
22
|
sharepoint_url = dbutils.secrets.get("SHAREPOINT", "url")
|
|
23
23
|
site_url = f"{sharepoint_url}/sites/{site_name}"
|
|
24
|
+
tenant = dbutils.secrets.get("SHAREPOINT", "tenant")
|
|
24
25
|
client_id = dbutils.secrets.get("SHAREPOINT", "app_id")
|
|
25
|
-
|
|
26
|
+
thumbprint = dbutils.secrets.get("SHAREPOINT", "cert_thumbprint")
|
|
27
|
+
private_key = dbutils.secrets.get("SHAREPOINT", "cert_private_key")
|
|
26
28
|
|
|
27
|
-
return ClientContext(site_url).
|
|
29
|
+
return ClientContext(site_url).with_client_certificate(
|
|
30
|
+
tenant=tenant,
|
|
31
|
+
client_id=client_id,
|
|
32
|
+
thumbprint=thumbprint,
|
|
33
|
+
private_key=private_key,
|
|
34
|
+
)
|
|
28
35
|
|
|
29
36
|
|
|
30
37
|
def _execute_query_with_backoff(
|
|
@@ -276,6 +283,27 @@ def df_from_sharepoint_csv_utf8(
|
|
|
276
283
|
return df
|
|
277
284
|
|
|
278
285
|
|
|
286
|
+
def df_from_sharepoint_excel(item_path, site_name="VyMasterdata", **kwargs) -> DataFrame:
|
|
287
|
+
"""Gets the bytes from an excel file in sharepoint and converts it to a spark dataframe.
|
|
288
|
+
|
|
289
|
+
Requires the 'openpyxl' package, install it with '%pip install openpyxl'.
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
item_path (str) : path relative to the site the file is located. Initiate the path with '/'
|
|
293
|
+
site_name (str) : name of site to fetch the file from
|
|
294
|
+
**kwargs : additional keyword arguments passed directly to pd.read_excel
|
|
295
|
+
Returns:
|
|
296
|
+
(spark.DataFrame) dataframe of the excel sheet
|
|
297
|
+
"""
|
|
298
|
+
file_bytesio = _get_file_bytes_from_sharepoint(item_path, site_name)
|
|
299
|
+
dp = pd.read_excel(io=file_bytesio, **kwargs)
|
|
300
|
+
dp = dp.replace([np.nan], [None])
|
|
301
|
+
|
|
302
|
+
df = spark.createDataFrame(dp)
|
|
303
|
+
|
|
304
|
+
return df
|
|
305
|
+
|
|
306
|
+
|
|
279
307
|
# # Functions for traversing and extracting files and folders from a site # #
|
|
280
308
|
def get_files_in_folder(relative_path_to_folder, site_name="VyMasterdata"):
|
|
281
309
|
"""
|
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/__init__.py
RENAMED
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/data_product.py
RENAMED
|
File without changes
|
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/dataframe.py
RENAMED
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/extend_class.py
RENAMED
|
File without changes
|
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/logging.py
RENAMED
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/oracle.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/snaplogic.py
RENAMED
|
File without changes
|
|
File without changes
|
{databricks_modules_vy-1.1.23 → databricks_modules_vy-1.2.1}/databricks_modules_vy/unity_catalog.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|