1010 ResultDisposition ,
1111 ResultCompression ,
1212 WaitTimeout ,
13+ MetadataCommands ,
1314)
1415
1516if TYPE_CHECKING :
@@ -635,7 +636,7 @@ def get_catalogs(
635636 ) -> "ResultSet" :
636637 """Get available catalogs by executing 'SHOW CATALOGS'."""
637638 result = self .execute_command (
638- operation = "SHOW CATALOGS" ,
639+ operation = MetadataCommands . SHOW_CATALOGS . value ,
639640 session_id = session_id ,
640641 max_rows = max_rows ,
641642 max_bytes = max_bytes ,
@@ -662,10 +663,10 @@ def get_schemas(
662663 if not catalog_name :
663664 raise ValueError ("Catalog name is required for get_schemas" )
664665
665- operation = f"SHOW SCHEMAS IN { catalog_name } "
666+ operation = MetadataCommands . SHOW_SCHEMAS . value . format ( catalog_name )
666667
667668 if schema_name :
668- operation += f" LIKE ' { schema_name } '"
669+ operation += MetadataCommands . LIKE_PATTERN . value . format ( schema_name )
669670
670671 result = self .execute_command (
671672 operation = operation ,
@@ -697,17 +698,19 @@ def get_tables(
697698 if not catalog_name :
698699 raise ValueError ("Catalog name is required for get_tables" )
699700
700- operation = "SHOW TABLES IN " + (
701- "ALL CATALOGS"
701+ operation = (
702+ MetadataCommands . SHOW_TABLES_ALL_CATALOGS . value
702703 if catalog_name in [None , "*" , "%" ]
703- else f"CATALOG { catalog_name } "
704+ else MetadataCommands .SHOW_TABLES .value .format (
705+ MetadataCommands .CATALOG_SPECIFIC .value .format (catalog_name )
706+ )
704707 )
705708
706709 if schema_name :
707- operation += f" SCHEMA LIKE ' { schema_name } '"
710+ operation += MetadataCommands . SCHEMA_LIKE_PATTERN . value . format ( schema_name )
708711
709712 if table_name :
710- operation += f" LIKE ' { table_name } '"
713+ operation += MetadataCommands . LIKE_PATTERN . value . format ( table_name )
711714
712715 result = self .execute_command (
713716 operation = operation ,
@@ -745,16 +748,16 @@ def get_columns(
745748 if not catalog_name :
746749 raise ValueError ("Catalog name is required for get_columns" )
747750
748- operation = f"SHOW COLUMNS IN CATALOG { catalog_name } "
751+ operation = MetadataCommands . SHOW_COLUMNS . value . format ( catalog_name )
749752
750753 if schema_name :
751- operation += f" SCHEMA LIKE ' { schema_name } '"
754+ operation += MetadataCommands . SCHEMA_LIKE_PATTERN . value . format ( schema_name )
752755
753756 if table_name :
754- operation += f" TABLE LIKE ' { table_name } '"
757+ operation += MetadataCommands . TABLE_LIKE_PATTERN . value . format ( table_name )
755758
756759 if column_name :
757- operation += f" LIKE ' { column_name } '"
760+ operation += MetadataCommands . LIKE_PATTERN . value . format ( column_name )
758761
759762 result = self .execute_command (
760763 operation = operation ,
0 commit comments