Back to Convex Backend

Fivetran for Convex | Destination Setup Guide

crates/fivetran_destination/docs/setup-guide.md

latest3.9 KB
Original Source

Convex Setup Guide {% badge text="Partner-Built" /%} {% availabilityBadge connector="convex_destination" /%}

Follow our setup guide to connect Fivetran to Convex as a destination.

NOTE: This destination is partner-built. For any questions related to the Convex destination and its documentation, refer to Convex's support team. For SLA details, see Convex's Status and Guarantees documentation.


Prerequisites

To connect your Convex deployment to Fivetran, you need the following:


Setup instructions

<span class="step-item">Find your deployment credentials</span>

  1. Go to your deployment on the Convex Dashboard.
  2. Go to the Production Deployment Settings.
  3. Find your deployment URL and deploy key and make a note of them. You will need them to configure Fivetran.

<span class="step-item">Complete Fivetran configuration</span>

  1. Log in to your Fivetran account.
  2. Go to the Destinations page and click Add destination.
  3. Enter a Destination name of your choice and then click Add.
  4. Select Convex as the destination type.
  5. Enter your deployment credentials.
  6. Click Save & Test. Fivetran tests and validates connection to your Convex deployment.

<span class="step-item">Using Convex destination with a source connector</span>

  1. In your Fivetran dashboard, click Connectors > Add Connector.
  2. Select and configure a data source of your choice.
  3. Select the Convex destination you connected to.
  4. Start your initial sync by clicking Sync Now.
  5. The initial sync may fail with a user action to update convex/schema.ts. Follow the instructions in the error message to update your schema.ts. The error message will give you code to copy-paste into your schema.ts. It may take around 20 minutes for the error to appear.
  6. Deploy your schema.ts with npx convex deploy.
  7. Retry your initial sync by clicking Sync Now.

The example below is a sample schema.ts for a source with a single table email.cars.

typescript
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

const fivetranTables = {
  email_cars: defineTable({
    description: v.union(v.string(), v.null()),
    fivetran: v.object({
      columns: v.object({
        directory: v.union(v.string(), v.null()),
        file: v.union(v.string(), v.null()),
        line: v.union(v.int64(), v.null()),
        modified: v.union(v.float64(), v.null()),
      }),
      synced: v.float64(),
    }),
    make: v.union(v.string(), v.null()),
    model: v.union(v.string(), v.null()),
    price: v.union(v.float64(), v.null()),
    year: v.union(v.int64(), v.null()),
  })
    .index("by_fivetran_synced", ["fivetran.synced"])
    .index("by_primary_key", [
      "fivetran.columns.directory",
      "fivetran.columns.file",
      "fivetran.columns.line",
      "fivetran.columns.modified",
    ]),
};

export default defineSchema({
  ...fivetranTables,
});

<i aria-hidden="true" class="material-icons">description</i> Destination Overview

<b> </b>

<i aria-hidden="true" class="material-icons">home</i> Documentation Home