99from databricks .sql .backend .column_mapping import (
1010 normalise_metadata_result ,
1111 MetadataOp ,
12- CATALOG_OP ,
13- SCHEMA_OP ,
14- TABLE_OP ,
15- COLUMN_OP ,
1612)
1713
1814
@@ -95,25 +91,24 @@ def test_normalize_metadata_result_columns(self):
9591 ("catalogName" , "string" , None , None , None , None , True ),
9692 ("namespace" , "string" , None , None , None , None , True ),
9793 ("tableName" , "string" , None , None , None , None , True ),
98- ("columnName " , "string" , None , None , None , None , True ),
94+ ("col_name " , "string" , None , None , None , None , True ),
9995 ("dataType" , "string" , None , None , None , None , True ),
100- ("columnType" , "string" , None , None , None , None , True ),
10196 ("columnSize" , "string" , None , None , None , None , True ),
10297 ("bufferLength" , "string" , None , None , None , None , True ),
10398 ("decimalDigits" , "string" , None , None , None , None , True ),
10499 ("radix" , "string" , None , None , None , None , True ),
105- ("nullable " , "string" , None , None , None , None , True ),
100+ ("Nullable " , "string" , None , None , None , None , True ),
106101 ("remarks" , "string" , None , None , None , None , True ),
107- ("columnDef " , "string" , None , None , None , None , True ),
108- ("sqlDataType " , "string" , None , None , None , None , True ),
109- ("sqlDatetimeSub " , "string" , None , None , None , None , True ),
110- ("charOctetLength " , "string" , None , None , None , None , True ),
102+ ("columnType " , "string" , None , None , None , None , True ),
103+ ("SQLDataType " , "string" , None , None , None , None , True ),
104+ ("SQLDatetimeSub " , "string" , None , None , None , None , True ),
105+ ("CharOctetLength " , "string" , None , None , None , None , True ),
111106 ("ordinalPosition" , "string" , None , None , None , None , True ),
112107 ("isNullable" , "string" , None , None , None , None , True ),
113- ("scopeCatalog " , "string" , None , None , None , None , True ),
114- ("scopeSchema " , "string" , None , None , None , None , True ),
115- ("scopeTable " , "string" , None , None , None , None , True ),
116- ("sourceDataType " , "string" , None , None , None , None , True ),
108+ ("ScopeCatalog " , "string" , None , None , None , None , True ),
109+ ("ScopeSchema " , "string" , None , None , None , None , True ),
110+ ("ScopeTable " , "string" , None , None , None , None , True ),
111+ ("SourceDataType " , "string" , None , None , None , None , True ),
117112 ("isAutoIncrement" , "string" , None , None , None , None , True ),
118113 ("isGenerated" , "string" , None , None , None , None , True ),
119114 ("other_column" , "string" , None , None , None , None , True ),
@@ -128,26 +123,25 @@ def test_normalize_metadata_result_columns(self):
128123 assert mock_result .description [2 ][0 ] == "TABLE_NAME"
129124 assert mock_result .description [3 ][0 ] == "COLUMN_NAME"
130125 assert mock_result .description [4 ][0 ] == "DATA_TYPE"
131- assert mock_result .description [5 ][0 ] == "TYPE_NAME"
132- assert mock_result .description [6 ][0 ] == "COLUMN_SIZE"
133- assert mock_result .description [7 ][0 ] == "BUFFER_LENGTH"
134- assert mock_result .description [8 ][0 ] == "DECIMAL_DIGITS"
135- assert mock_result .description [9 ][0 ] == "NUM_PREC_RADIX"
136- assert mock_result .description [10 ][0 ] == "NULLABLE"
137- assert mock_result .description [11 ][0 ] == "REMARKS"
138- assert mock_result .description [12 ][0 ] == "COLUMN_DEF"
139- assert mock_result .description [13 ][0 ] == "SQL_DATA_TYPE"
140- assert mock_result .description [14 ][0 ] == "SQL_DATETIME_SUB"
141- assert mock_result .description [15 ][0 ] == "CHAR_OCTET_LENGTH"
142- assert mock_result .description [16 ][0 ] == "ORDINAL_POSITION"
143- assert mock_result .description [17 ][0 ] == "IS_NULLABLE"
144- assert mock_result .description [18 ][0 ] == "SCOPE_CATALOG"
145- assert mock_result .description [19 ][0 ] == "SCOPE_SCHEMA"
146- assert mock_result .description [20 ][0 ] == "SCOPE_TABLE"
147- assert mock_result .description [21 ][0 ] == "SOURCE_DATA_TYPE"
148- assert mock_result .description [22 ][0 ] == "IS_AUTOINCREMENT"
149- assert mock_result .description [23 ][0 ] == "IS_GENERATEDCOLUMN"
150- assert mock_result .description [24 ][0 ] == "other_column"
126+ assert mock_result .description [5 ][0 ] == "COLUMN_SIZE"
127+ assert mock_result .description [6 ][0 ] == "BUFFER_LENGTH"
128+ assert mock_result .description [7 ][0 ] == "DECIMAL_DIGITS"
129+ assert mock_result .description [8 ][0 ] == "NUM_PREC_RADIX"
130+ assert mock_result .description [9 ][0 ] == "NULLABLE"
131+ assert mock_result .description [10 ][0 ] == "REMARKS"
132+ assert mock_result .description [11 ][0 ] == "COLUMN_DEF"
133+ assert mock_result .description [12 ][0 ] == "SQL_DATA_TYPE"
134+ assert mock_result .description [13 ][0 ] == "SQL_DATETIME_SUB"
135+ assert mock_result .description [14 ][0 ] == "CHAR_OCTET_LENGTH"
136+ assert mock_result .description [15 ][0 ] == "ORDINAL_POSITION"
137+ assert mock_result .description [16 ][0 ] == "IS_NULLABLE"
138+ assert mock_result .description [17 ][0 ] == "SCOPE_CATALOG"
139+ assert mock_result .description [18 ][0 ] == "SCOPE_SCHEMA"
140+ assert mock_result .description [19 ][0 ] == "SCOPE_TABLE"
141+ assert mock_result .description [20 ][0 ] == "SOURCE_DATA_TYPE"
142+ assert mock_result .description [21 ][0 ] == "IS_AUTOINCREMENT"
143+ assert mock_result .description [22 ][0 ] == "IS_GENERATEDCOLUMN"
144+ assert mock_result .description [23 ][0 ] == "other_column"
151145
152146 def test_normalize_metadata_result_unknown_operation (self ):
153147 """Test normalizing with an unknown operation type."""
0 commit comments