From ad18215a9cdf799e6acc63d614f0e7f2a50d860c Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Wed, 13 Nov 2024 14:59:05 +0100 Subject: [PATCH 1/5] render all metadata columns on request --- .../sharepoint-online_lists/connector.json | 12 ++++++++++-- python-lib/sharepoint_client.py | 8 +++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/python-connectors/sharepoint-online_lists/connector.json b/python-connectors/sharepoint-online_lists/connector.json index d25181f..642b357 100644 --- a/python-connectors/sharepoint-online_lists/connector.json +++ b/python-connectors/sharepoint-online_lists/connector.json @@ -105,8 +105,8 @@ }, { "name": "advanced_parameters", - "label": "Show advanced parameters", - "description": "", + "label": " ", + "description": "Show advanced parameters", "type": "BOOLEAN", "defaultValue": false }, @@ -125,6 +125,14 @@ "defaultValue": "", "visibilityCondition": "model.advanced_parameters == true" }, + { + "name": "are_metadata_columns_visible", + "label": " ", + "description": "Render all metadata columns", + "type": "BOOLEAN", + "defaultValue": false, + "visibilityCondition": "model.advanced_parameters == true" + }, { "name": "write_mode", "label": "Write mode", diff --git a/python-lib/sharepoint_client.py b/python-lib/sharepoint_client.py index 656b3e0..a143f62 100644 --- a/python-lib/sharepoint_client.py +++ b/python-lib/sharepoint_client.py @@ -41,6 +41,7 @@ def __init__(self, config): self.session = RobustSession(status_codes_to_retry=[429, 503], attempt_session_reset_on_403=attempt_session_reset_on_403) self.number_dumped_logs = 0 self.username_for_namespace_diag = None + self.are_metadata_columns_visible = config.get("advanced_parameters", False) and config.get("are_metadata_columns_visible", False) self.dss_column_name = {} self.column_ids = {} @@ -948,7 +949,10 @@ def get_read_schema(self, display_metadata=False, metadata_to_retrieve=[]): self.is_column_displayable(column, display_metadata, metadata_to_retrieve) )) if self.is_column_displayable(column, display_metadata, metadata_to_retrieve): - sharepoint_type = get_dss_type(column[SharePointConstants.TYPE_AS_STRING]) + sharepoint_type = get_dss_type( + column[SharePointConstants.TYPE_AS_STRING], + with_computed=self.are_metadata_columns_visible + ) self.column_sharepoint_type[column[SharePointConstants.STATIC_NAME]] = column[SharePointConstants.TYPE_AS_STRING] if sharepoint_type is not None: dss_columns.append({ @@ -968,6 +972,8 @@ def get_read_schema(self, display_metadata=False, metadata_to_retrieve=[]): } def is_column_displayable(self, column, display_metadata=False, metadata_to_retrieve=[]): + if self.are_metadata_columns_visible: + return True if display_metadata and (column['StaticName'] in metadata_to_retrieve): return True return (not column[SharePointConstants.HIDDEN_COLUMN]) From e2fba172eaff0502b8bd9bf78020a406f6e1ef59 Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Wed, 13 Nov 2024 14:59:30 +0100 Subject: [PATCH 2/5] makes computed columns visible --- python-lib/sharepoint_constants.py | 13 +++++++++++++ python-lib/sharepoint_lists.py | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/python-lib/sharepoint_constants.py b/python-lib/sharepoint_constants.py index 50be05f..677c210 100644 --- a/python-lib/sharepoint_constants.py +++ b/python-lib/sharepoint_constants.py @@ -54,6 +54,19 @@ class SharePointConstants(object): "User": "array", "Thumbnail": "object" } + TYPES_WITH_COMPUTED = { + "Text": "string", + "Number": "string", + "DateTime": "date", + "Boolean": "string", + "URL": "object", + "Location": "object", + "Computed": "string", + "Attachments": None, + "Calculated": "string", + "User": "array", + "Thumbnail": "object" + } TYPE_AS_STRING = 'TypeAsString' TYPE_COLUMN = 'type' VALUE = 'value' diff --git a/python-lib/sharepoint_lists.py b/python-lib/sharepoint_lists.py index 508a2b7..664d6dd 100644 --- a/python-lib/sharepoint_lists.py +++ b/python-lib/sharepoint_lists.py @@ -16,8 +16,11 @@ def extract_results(response): return response[SharePointConstants.RESULTS_CONTAINER_V2][SharePointConstants.RESULTS] -def get_dss_type(sharepoint_type): - return SharePointConstants.TYPES.get(sharepoint_type, DSSConstants.FALLBACK_TYPE) +def get_dss_type(sharepoint_type, with_computed=False): + if with_computed: + return SharePointConstants.TYPES_WITH_COMPUTED.get(sharepoint_type, DSSConstants.FALLBACK_TYPE) + else: + return SharePointConstants.TYPES.get(sharepoint_type, DSSConstants.FALLBACK_TYPE) def get_sharepoint_type(dss_type): From 2c6080d4bbf639e0bf4357a13a36359f80b54ffe Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Wed, 13 Nov 2024 15:00:00 +0100 Subject: [PATCH 3/5] version 1.1.5 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index c357c1b..cdb516f 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "id": "sharepoint-online", - "version": "1.1.4", + "version": "1.1.5", "meta": { "label": "SharePoint Online", "description": "Read and write data from/to your SharePoint Online account", From bd569194d011975112eb66a3ef1c984c9eac2822 Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Wed, 13 Nov 2024 15:00:12 +0100 Subject: [PATCH 4/5] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3cbddb..0cc8e82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [Version 1.1.5](https://github.com/dataiku/dss-plugin-sharepoint-online/releases/tag/v1.1.5) - Feature release - 2024-11-13 + +- Add option to retrieve metadata columns, provided they are visible in the selected view + ## [Version 1.1.4](https://github.com/dataiku/dss-plugin-sharepoint-online/releases/tag/v1.1.4) - Feature release - 2024-07-16 - Fix writing when using presets with no root folder defined From 3d6f6640f96ff8eb094223c9087ba0cb9f32f6c3 Mon Sep 17 00:00:00 2001 From: Alexandre Bourret Date: Wed, 13 Nov 2024 15:00:20 +0100 Subject: [PATCH 5/5] beta 1 --- python-lib/dss_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-lib/dss_constants.py b/python-lib/dss_constants.py index 89fedcc..7f95042 100644 --- a/python-lib/dss_constants.py +++ b/python-lib/dss_constants.py @@ -37,7 +37,7 @@ class DSSConstants(object): "sharepoint_oauth": "The access token is missing" } PATH = 'path' - PLUGIN_VERSION = "1.1.4" + PLUGIN_VERSION = "1.1.5-beta.1" SECRET_PARAMETERS_KEYS = ["Authorization", "sharepoint_username", "sharepoint_password", "client_secret", "client_certificate", "passphrase"] SITE_APP_DETAILS = { "sharepoint_tenant": "The tenant name is missing",