Skip to content

Commit

Permalink
feat(kw-search): pass title & mime when upserting tables from connect…
Browse files Browse the repository at this point in the history
…ors (#8962)

* feat(kw-search): pass title and mimetype when upserting tables from connectors

* improve mimetype for notion DB

---------

Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Nov 27, 2024
1 parent 551d655 commit 04d68c9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ async function upsertGdriveTable(
truncate: true,
parents: [tableId, ...parents],
useAppForHeaderDetection: true,
title: `${spreadsheet.title} - ${title}`,
mimeType: "application/vnd.google-apps.spreadsheet",
});

logger.info(loggerArgs, "[Spreadsheet] Table upserted.");
Expand Down
3 changes: 3 additions & 0 deletions connectors/src/connectors/microsoft/temporal/spreadsheets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ async function upsertMSTable(
truncate: true,
parents,
useAppForHeaderDetection: true,
title: `${spreadsheet.name} - ${worksheet.name}`,
mimeType:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});

logger.info(loggerArgs, "[Spreadsheet] Table upserted.");
Expand Down
4 changes: 4 additions & 0 deletions connectors/src/connectors/notion/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,8 @@ export async function renderAndUpsertPageFromCache({
// We only update the rowId of for the page without truncating the rest of the table (incremental sync).
truncate: false,
parents,
title: parentDb.title ?? "Untitled Notion Database",
mimeType: "application/vnd.notion.database",
}),
localLogger
);
Expand Down Expand Up @@ -2522,6 +2524,8 @@ export async function upsertDatabaseStructuredDataFromCache({
// We overwrite the whole table since we just fetched all child pages.
truncate: true,
parents,
title: dbModel.title ?? "Untitled Notion Database",
mimeType: "notion/database",
}),
localLogger
);
Expand Down
2 changes: 2 additions & 0 deletions connectors/src/connectors/shared/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export async function handleCsvFile({
},
truncate: true,
parents,
title: fileName,
mimeType: "text/csv",
});
} catch (err) {
localLogger.warn({ error: err }, "Error while parsing or upserting table");
Expand Down
6 changes: 6 additions & 0 deletions connectors/src/lib/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,8 @@ export async function upsertTableFromCsv({
truncate,
parents,
useAppForHeaderDetection,
title,
mimeType,
}: {
dataSourceConfig: DataSourceConfig;
tableId: string;
Expand All @@ -719,6 +721,8 @@ export async function upsertTableFromCsv({
truncate: boolean;
parents: string[];
useAppForHeaderDetection?: boolean;
title: string;
mimeType: string;
}) {
const localLogger = logger.child({ ...loggerArgs, tableId, tableName });
const statsDTags = [
Expand Down Expand Up @@ -754,6 +758,8 @@ export async function upsertTableFromCsv({
truncate,
async: true,
useAppForHeaderDetection,
title,
mimeType,
};
const dustRequestConfig: AxiosRequestConfig = {
headers: {
Expand Down

0 comments on commit 04d68c9

Please sign in to comment.