File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -97,14 +97,20 @@ def create_table_with_index_params(
9797 )
9898 if sparse_vidxs is not None and len (sparse_vidxs ) > 0 :
9999 create_table_sql = str (CreateTable (table ).compile (self .engine ))
100- new_sql = create_table_sql [: create_table_sql .rfind (")" )]
100+ # Preserve table options (e.g. ORGANIZATION=heap) after the closing ")"
101+ last_paren = create_table_sql .rfind (")" )
102+ table_options_suffix = create_table_sql [
103+ last_paren :
104+ ] # e.g. ")ORGANIZATION=heap"
105+ new_sql = create_table_sql [:last_paren ]
101106 for sparse_vidx in sparse_vidxs :
102107 sparse_params = sparse_vidx ._parse_kwargs ()
103108 if "type" in sparse_params :
104109 new_sql += f",\n \t VECTOR INDEX { sparse_vidx .index_name } ({ sparse_vidx .field_name } ) with (type={ sparse_params ['type' ]} , distance=inner_product)"
105110 else :
106111 new_sql += f",\n \t VECTOR INDEX { sparse_vidx .index_name } ({ sparse_vidx .field_name } ) with (distance=inner_product)"
107- new_sql += "\n )"
112+ # Restore table options after the new closing ")"
113+ new_sql += "\n )" + table_options_suffix [1 :]
108114 conn .execute (text (new_sql ))
109115 else :
110116 table .create (self .engine , checkfirst = True )
You can’t perform that action at this time.
0 commit comments