@@ -553,6 +553,17 @@ def meta_get_tables(self, table_names: Optional[List[str]] = None, **kwargs) ->
553553 except Exception :
554554 logger .exception (f"Error retrieving metadata for table { table_name } :" )
555555
556+ if len (df .columns ) == 0 :
557+ df = pd .DataFrame (
558+ columns = [
559+ "TABLE_NAME" ,
560+ "TABLE_TYPE" ,
561+ "TABLE_SCHEMA" ,
562+ "TABLE_DESCRIPTION" ,
563+ "ROW_COUNT" ,
564+ ]
565+ )
566+
556567 return Response (RESPONSE_TYPE .TABLE , df )
557568
558569 def meta_get_columns (self , table_names : Optional [List [str ]] = None , ** kwargs ) -> Response :
@@ -575,6 +586,18 @@ def meta_get_columns(self, table_names: Optional[List[str]] = None, **kwargs) ->
575586 except Exception :
576587 logger .exception (f"Error retrieving column metadata for table { table_name } :" )
577588
589+ if len (df .columns ) == 0 :
590+ df = pd .DataFrame (
591+ columns = [
592+ "TABLE_NAME" ,
593+ "COLUMN_NAME" ,
594+ "DATA_TYPE" ,
595+ "COLUMN_DESCRIPTION" ,
596+ "IS_NULLABLE" ,
597+ "COLUMN_DEFAULT" ,
598+ ]
599+ )
600+
578601 return Response (RESPONSE_TYPE .TABLE , df )
579602
580603 def meta_get_column_statistics (self , table_names : Optional [List [str ]] = None , ** kwargs ) -> Response :
@@ -597,6 +620,20 @@ def meta_get_column_statistics(self, table_names: Optional[List[str]] = None, **
597620 except Exception :
598621 logger .exception (f"Error retrieving column statistics for table { table_name } :" )
599622
623+ if len (df .columns ) == 0 :
624+ df = pd .DataFrame (
625+ columns = [
626+ "TABLE_NAME" ,
627+ "COLUMN_NAME" ,
628+ "MOST_COMMON_VALUES" ,
629+ "MOST_COMMON_FREQUENCIES" ,
630+ "NULL_PERCENTAGE" ,
631+ "MINIMUM_VALUE" ,
632+ "MAXIMUM_VALUE" ,
633+ "DISTINCT_VALUES_COUNT" ,
634+ ]
635+ )
636+
600637 return Response (RESPONSE_TYPE .TABLE , df )
601638
602639 def meta_get_primary_keys (self , table_names : Optional [List [str ]] = None , ** kwargs ) -> Response :
@@ -619,6 +656,16 @@ def meta_get_primary_keys(self, table_names: Optional[List[str]] = None, **kwarg
619656 except Exception :
620657 logger .exception (f"Error retrieving primary keys for table { table_name } :" )
621658
659+ if len (df .columns ) == 0 :
660+ df = pd .DataFrame (
661+ columns = [
662+ "TABLE_NAME" ,
663+ "COLUMN_NAME" ,
664+ "ORDINAL_POSITION" ,
665+ "CONSTRAINT_NAME" ,
666+ ]
667+ )
668+
622669 return Response (RESPONSE_TYPE .TABLE , df )
623670
624671 def meta_get_foreign_keys (self , table_names : Optional [List [str ]] = None , ** kwargs ) -> Response :
@@ -644,6 +691,17 @@ def meta_get_foreign_keys(self, table_names: Optional[List[str]] = None, **kwarg
644691 except Exception :
645692 logger .exception (f"Error retrieving foreign keys for table { table_name } :" )
646693
694+ if len (df .columns ) == 0 :
695+ df = pd .DataFrame (
696+ columns = [
697+ "PARENT_TABLE_NAME" ,
698+ "PARENT_COLUMN_NAME" ,
699+ "CHILD_TABLE_NAME" ,
700+ "CHILD_COLUMN_NAME" ,
701+ "CONSTRAINT_NAME" ,
702+ ]
703+ )
704+
647705 return Response (RESPONSE_TYPE .TABLE , df )
648706
649707
0 commit comments