Docs about Docs logo Docs about Docs

About this template

File location: /_templates/integrations
Used in:
Repo link: Click to view in the Stitch Docs repo
Instructions:

This template is used to create foriegn key references in SaaS integration table schema documentation.


Template sections

Each template is grouped into sections to make parameters easier to find. These sections and the parameters they contain are described below.

Tap details

The integration’s name and version.

Parameter Description
tap
STRING

The name of the integration, corresponding to the value of name in the integration’s doc. For example: Entering github would associate the file with the GitHub integration.

version
STRING

The applicable version of the integration.

Example values:

  • 1
  • 2
Back to top

Foreign key details

The high-level details about the foreign key.

For every key you want to list, there must be an item in foreign-keys containing the attributes listed in the section below:

foreign-keys:
  - id: "customer-id"
    attribute: "customerId"
    table: "customers"
    all-foreign-keys:
      - table: "customers"
        join-on: "id"
      - table: "orders"
      - table: "refunds"

  - id: "order-id"
    attribute: "orderId"
    table: "orders"
    all-foreign-keys:
      - table: "orders"
        join-on: "id"
      - table: "refunds"
Parameter Description
id
STRING

The foreign key ID. This is the name of the column with dashes separating individual words.

For example: CustomerID would be customer-id

Example values:

  • account-id
  • currency-code
  • purchase-order-id
attribute
STRING

The name of the key, typically as the most common version of the key name.

For example: If many tables have a customerid attribute, that would be entered here.

table
STRING

If applicable, the name of the ‘parent’ table for the foreign key.

For example: If the attribute were customerid, this might be customers

Back to top

Foreign key list

This corresponds to the attributes found in the all-foreign-keys list of foreign-keys.

This list must exist for every item in foreign-keys. At a minimum, every item in the all-foreign-keys list must contain the table attribute:

foreign-keys:
  - id: "customer-id"
    attribute: "customerId"
    table: "customers"
    all-foreign-keys:
      - table: "customers"
        join-on: "id"
      - table: "orders"
      - table: "refunds"
Parameter Description
table
STRING

The name of the table that contains the foreign key.

subtable
STRING

If the key exists in a subtable, you can add an additional subtable attribute. This is used with table to create the full name of the table the attribute is in.

For example:

- id: "app-store-id"
  attribute: "app_store_id"
  table: "ads"
  all-foreign-keys:
    - table: "adcreative"
      subtable: "template_url_spec__ios"

This would create a reference like this: adcreative__template_url_spec__ios.app_store_id

join-on
STRING

The name of the attribute that can be used to join the tables together.

Note: This is only required if the name of the attribute in the table is different than what’s in foreign-keys.attribute.

For example: In parent tables, the key is usually named id, whereas in other tables, it might be customerId:

foreign-keys:
  - id: "customer-id"
    attribute: "customerId"
    table: "customers"
    all-foreign-keys:
      - table: "customers"
        join-on: "id"
      - table: "orders"

In this case, the orders table doesn’t need the join-on attribute listed with it, since it matches attribute: "customerId".

Back to top
Back to top

Last updated: 28 July 2021