Home / Function/ insertSectionBatch() — supabase Function Reference

insertSectionBatch() — supabase Function Reference

Architecture documentation for the insertSectionBatch() function in generate-embeddings.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  6e840ab5_8116_4027_1a88_735f8e359283["insertSectionBatch()"]
  e004e86e_d6b3_597d_5a6c_1a898d503de3["processAndInsertEmbeddings()"]
  e004e86e_d6b3_597d_5a6c_1a898d503de3 -->|calls| 6e840ab5_8116_4027_1a88_735f8e359283
  999b9bcb_cbf3_994c_468b_34a61e74d416["withRetry()"]
  6e840ab5_8116_4027_1a88_735f8e359283 -->|calls| 999b9bcb_cbf3_994c_468b_34a61e74d416
  style 6e840ab5_8116_4027_1a88_735f8e359283 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/scripts/search/generate-embeddings.ts lines 394–426

async function insertSectionBatch(
  supabaseClient: SupabaseClient,
  pageSectionTable: string,
  sectionsWithEmbeddings: PageSectionWithEmbedding[]
): Promise<number> {
  if (sectionsWithEmbeddings.length === 0) {
    return 0
  }

  const pageSectionsToInsert = sectionsWithEmbeddings.map((section) => ({
    page_id: section.pageId,
    slug: section.slug,
    heading: section.heading,
    content: section.content,
    embedding: section.embedding,
    rag_ignore: section.ragIgnore,
  }))

  await withRetry(
    async () => {
      const { error } = await supabaseClient.from(pageSectionTable).insert(pageSectionsToInsert)

      if (error) {
        throw new Error(`Supabase insert error: ${error.message}`)
      }
    },
    CONFIG.SUPABASE_MAX_RETRIES,
    CONFIG.SUPABASE_BASE_DELAY_MS,
    `Insert batch of ${sectionsWithEmbeddings.length} sections`
  )

  return sectionsWithEmbeddings.length
}

Subdomains

Calls

Frequently Asked Questions

What does insertSectionBatch() do?
insertSectionBatch() is a function in the supabase codebase.
What does insertSectionBatch() call?
insertSectionBatch() calls 1 function(s): withRetry.
What calls insertSectionBatch()?
insertSectionBatch() is called by 1 function(s): processAndInsertEmbeddings.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free