Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(fivetran_sdk): Updated development guide for partners #43

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,32 @@ The following are hard requirements to be able to deploy Partner code to Fivetra
- Encrypt HTTP requests: Things like URLs, URL parameters, and query params are always encrypted for logging, and customer approval is needed to decrypt and examine them.


## Connector Guidelines
## Setup Form Guidelines
- Keep the form clear and concise, only requesting essential information for successful connector setup.
- Use clear and descriptive labels for each form field. Avoid technical jargon if possible.
- Organize the fields in a logical order that reflects the setup process.

### RPC Calls
#### ConfigurationForm
This operation retrieves all the setup form fields and tests info required to establish a connection. You can provide various parameters for the fields to enhance the user experience, such as descriptions, optional fields, and more.
manjutapali marked this conversation as resolved.
Show resolved Hide resolved

#### Test
The previous RPC call retrieves the tests that need to be executed during connection setup. This operation then invokes the test with the customer's credentials as parameters. Finally, it should return a success or failure indication for the test execution.

## Source Connector Guidelines

- Don't push anything other than source data to the destination. State will be saved to production DB and returned in `UpdateRequest`.
- Don't forget to handle new schemas/tables/columns per the information and user choices in `UpdateRequest#selection`.
- Make sure you checkpoint at least once an hour. The more frequently you do it, the better.

## Destination Guidelines
### RPC Calls
#### Schema
This operation should retrieve all the information about the customer's schemas, tables, and columns. It also offers an optional `selection_not_supported` field that indicates whether customers can select or deselect tables and columns within the Fivetran dashboard.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved

#### Update
This operation should retrieve data from the source. We provide a request using the `UpdateRequest` message, which includes the customer's state, credentials, and schema information. The response, delivered through the `UpdateResponse` message, should contain data records or other supported operations.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved

## Destination Connector Guidelines

- Do not push anything other than source data to the destination.

Expand Down Expand Up @@ -105,13 +124,18 @@ This operation should report all columns in the destination table, including Fiv
- This operation might be requested for a table that does not exist in the destination. In that case, it should NOT fail, simply ignore the request and return `success = true`.
- `utc_delete_before` has millisecond precision.

#### WriteBatchRequest
#### WriteBatch
This operations provides details about the batch files containing the retrieved data. We provide a parameter `WriteBatchRequest` which contains all the information required for you to read the batch files. Here are some of the fields included in the request message::
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved
- `replace_files` is for `upsert` operation where the rows should be inserted if they don't exist or updated if they do. Each row will always provide values for all columns. Set the `_fivetran_synced` column in the destination with the values coming in from the csv files.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved

- `update_files` is for `update` operation where modified columns have actual values whereas unmodified columns have the special value `unmodified_string` in `CsvFileParams`. Soft-deleted rows will arrive in here as well. Update the `_fivetran_synced` column in the destination with the values coming in from the csv files.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved

- `delete_files` is for `hard delete` operation. Use primary key columns (or `_fivetran_id` system column for primary-keyless tables) to perform `DELETE FROM`.

- `keys` is a map that provides a list of secret keys that can be used to decrypt batch files.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved

- `file_params` provides information about the file type and any configurations applied to it, such as encryption or compression.

Also, Fivetran will deduplicate operations such that each primary key will show up only once in any of the operations

Do not assume order of columns in the batch files. Always read the CSV file header to determine column order.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Do not assume order of columns in the batch files. Always read the CSV file header to determine column order.
Do not assume order of columns in the batch files. Always read the columns of batch file to determine column order.

Expand All @@ -120,6 +144,19 @@ Do not assume order of columns in the batch files. Always read the CSV file head
- `null_string` value is used to represent `NULL` value in all batch files.
- `unmodified_string` value is used to indicate columns in `update_files` where the values did not change.

#### Capabilities
This operation offers several additional features, as listed below:
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved

- Datatype Mappings: Supports adjusting partner data types for each Fivetran data type.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved
- Max value for columns: Provides an option to specify the maximum value for each data type.

#### AlterTable
This operation is used to communicate updates to a table. The `SchemaDiff` message within the `AlterTableRequest` parameter provides details about these updates:
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved
- Adding a column (`add_column`): Fivetran uses this field to provide information about a new column to be added in destination table.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved
- Update Column type (`change_column_type`): This field provides the info on updated Column from source that needs to be reflected in destination table.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved
- Primary key updates (`new_primary_key`): If the customer's primary key have changed, this field lists all the new primary key used.
fivetran-satvikpatil marked this conversation as resolved.
Show resolved Hide resolved


### Examples of Data Types
Examples of each [DataType](https://github.com/fivetran/fivetran_sdk/blob/main/common.proto#L73C6-L73C14) as they would appear in CSV batch files are as follows:
- UNSPECIFIED: This data type will never appear in batch files
Expand Down
Loading