DatriseETL com IA

Gerador de upsert

Upsert no Airtable: PATCH /records with performUpsert

Nomeie tabela, chave e colunas e receba a instrução que o Airtable realmente aceita, com uma guarda para que uma linha antiga nunca sobrescreva uma nova. Abaixo: como a mecânica funciona, o que quebra e como a Datrise carrega o Airtable de forma incremental.

As notas técnicas desta página estão em inglês.

Gere a instrução

A URL é atualizada enquanto você digita; compartilhe para entregar o formulário exato.

Instrução · PATCH /records with performUpsert

// PATCH https://api.airtable.com/v0/{baseId}/deals
// Authorization: Bearer {personal access token}
{
  "performUpsert": {
    "fieldsToMergeOn": ["id"]
  },
  "records": [
    {
      "fields": {
        "id": "…",
        "name": "…",
        "stage": "…",
        "amount": "…",
        "owner_id": "…",
        "updated_at": "…"
      }
    }
  ]
}

Como o upsert funciona no Airtable

Airtable's REST API supports upserts directly: a PATCH to the records endpoint with performUpsert.fieldsToMergeOn matches incoming records to existing ones on up to three fields and updates or creates them. The response separates createdRecords from updatedRecords, which is the only way to tell an insert from an update. Fields you do not send are left alone with PATCH and cleared with PUT.

The limits shape the loader. Ten records per request and five requests per second per base means a 5,000-row entity takes 500 requests over at least 100 seconds, so send batches sequentially and back off on HTTP 429. The merge fields must identify one record; if two existing records match, the request fails rather than choosing. Land a focused field set, because bases also cap total records.

Antes de executar

  • fieldsToMergeOn takes up to three fields and they must uniquely identify a record; when more than one existing record matches, the request fails rather than picking one.
  • Each request carries at most 10 records and each base allows 5 requests per second. A 5,000-row sync is 500 requests over at least 100 seconds; send them sequentially with backoff on HTTP 429.
  • The response lists createdRecords and updatedRecords ids separately, which is the only way to tell an insert from an update; a PATCH leaves unlisted fields untouched, a PUT clears them.

Perguntas frequentes

Which fields can I merge on?

Up to three fields whose combination is unique in the table, typically the source record id stored in a single-line text field. Linked-record and formula fields cannot be merge fields.

How fast can I sync?

Five requests per second per base, ten records each, so about 50 records per second at best. Exceeding it returns 429 and a short lockout; throttle client-side.

PATCH or PUT?

PATCH for syncs: it updates the listed fields and leaves others untouched. PUT rewrites the record and blanks any field you omit, including ones people edit by hand in the base.

O mesmo gerador para outros destinos

Pule a escrita do merge

A Datrise entrega entidades de CRM e SaaS no Airtable com exatamente esta mecânica, uma marca d'água sobre updated-at e colunas tipadas, então a instrução acima é a que roda por você. Entre na lista de espera para acesso antecipado.

Explorar o catálogo de integrações