Repository navigation
Datalake: Add manifest file support, fix profiler metrics, add array and json column type support - #13017
Conversation
30 failed tests on run #29490 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
||||||||||||||||||||
c603313 to
40c3238
Compare
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
| # we'll use the first dataframe chunk to get the column name. | ||
| column = dfs[0][get_decoded_column(entity_link)] | ||
| _type = DATALAKE_DATA_TYPES.get(column.dtypes.name, DataType.STRING.value) | ||
| _type = fetch_col_types(dfs[0], get_decoded_column(entity_link)) |
There was a problem hiding this comment.
having a common fetching of column types mechanism for data frames
| table_fqn = fqn.build( | ||
| self.metadata, | ||
| entity_type=Table, | ||
| service_name=self.context.database_service.name.__root__, | ||
| database_name=self.context.database.name.__root__, | ||
| schema_name=self.context.database_schema.name.__root__, | ||
| table_name=table_name, | ||
| skip_es_search=True, | ||
| ) | ||
|
|
||
| if filter_by_table( | ||
| self.config.sourceConfig.config.tableFilterPattern, | ||
| table_fqn | ||
| if self.config.sourceConfig.config.useFqnForFiltering | ||
| else table_name, | ||
| ): | ||
| self.status.filter( | ||
| table_fqn, | ||
| OBJECT_FILTERED_OUT_MESSAGE, | ||
| ) | ||
| return True |
There was a problem hiding this comment.
centralize common repeated code
| def _load_metadata_file(self, bucket_name: str) -> Optional[StorageContainerConfig]: | ||
| """ | ||
| Load the metadata template file from the root of the bucket, if it exists | ||
| """ | ||
| if self._is_metadata_file_present(bucket_name=bucket_name): | ||
| try: | ||
| logger.info( | ||
| f"Found metadata template file at - s3://{bucket_name}/{OPENMETADATA_TEMPLATE_FILE_NAME}" | ||
| ) | ||
| response_object = self.s3_client.get_object( | ||
| Bucket=bucket_name, Key=OPENMETADATA_TEMPLATE_FILE_NAME | ||
| ) | ||
| content = json.load(response_object["Body"]) | ||
| metadata_config = StorageContainerConfig.parse_obj(content) | ||
| return metadata_config | ||
| except Exception as exc: | ||
| logger.debug(traceback.format_exc()) | ||
| logger.warning( | ||
| f"Failed loading metadata file s3://{bucket_name}/{OPENMETADATA_TEMPLATE_FILE_NAME}-{exc}" | ||
| ) | ||
| return None | ||
|
|
||
| def _is_metadata_file_present(self, bucket_name: str): | ||
| return self.prefix_exits( | ||
| bucket_name=bucket_name, | ||
| prefix=OPENMETADATA_TEMPLATE_FILE_NAME, | ||
| ) | ||
|
|
There was a problem hiding this comment.
instead of using look before you leap, we will be using easier to ask for forgiveness pattern
| col_type = df[self.col.name].dtypes.name | ||
| if ( | ||
| col_type == "object" | ||
| and self.col.type in [DataType.FLOAT, DataType.ARRAY, DataType.JSON] | ||
| and any(df[self.col.name].values) | ||
| ): | ||
| df_col_value = df[self.col.name].dropna().to_list()[0] | ||
| else: | ||
| df_col_value = df[self.col.name].dropna().to_list() | ||
| counter.update(df_col_value) |
There was a problem hiding this comment.
This fixes object related and NaN related errors
| max_length_list = [] | ||
|
|
||
| for df in dfs: | ||
| if any(df[self.col.name]): | ||
| max_length_list.append( | ||
| length_vectorize_func( | ||
| df[self.col.name].dropna().astype(str) | ||
| ).max() | ||
| ) | ||
| if max_length_list: | ||
| return max(max_length_list) |
There was a problem hiding this comment.
This fixes object related and NaN related errors
| mean = None | ||
| if any(df[self.col.name]): | ||
| mean = length_vectorize_func( | ||
| df[self.col.name].dropna().astype(str) | ||
| ).mean() |
|
[open-metadata-ingestion] Kudos, SonarCloud Quality Gate passed! |








Describe your changes:
Fixes #11421
Fixes #12794
Fixes #12978
Allows user to specify openmetadata.json manifest file to allow ingesting of data without extensions
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>