MCPcopy Index your code
hub / github.com/dataease/SQLBot / sync_single_fields

Function sync_single_fields

backend/apps/datasource/crud/datasource.py:173–191  ·  view source on GitHub ↗
(session: SessionDep, trans: Trans, id: int)

Source from the content-addressed store, hash-verified

171
172
173def sync_single_fields(session: SessionDep, trans: Trans, id: int):
174 table = session.query(CoreTable).filter(CoreTable.id == id).first()
175 ds = session.query(CoreDatasource).filter(CoreDatasource.id == table.ds_id).first()
176
177 tables = getTablesByDs(session, ds)
178 t_name = []
179 for _t in tables:
180 t_name.append(_t.tableName)
181
182 if not table.table_name in t_name:
183 raise HTTPException(status_code=500, detail=trans('i18n_table_not_exist'))
184
185 # sync field
186 fields = getFieldsByDs(session, ds, table.table_name)
187 sync_fields(session, ds, table, fields)
188
189 # do table embedding
190 run_save_table_embeddings([table.id])
191 run_save_ds_embeddings([ds.id])
192
193
194def sync_table(session: SessionDep, ds: CoreDatasource, tables: List[CoreTable]):

Callers 1

sync_fieldsFunction · 0.85

Calls 8

run_save_ds_embeddingsFunction · 0.90
getTablesByDsFunction · 0.85
getFieldsByDsFunction · 0.85
sync_fieldsFunction · 0.70
firstMethod · 0.45
filterMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected