Docs about Docs logo Docs about Docs

About this template

File location:
  • /_templates/databases/data-files/user-privileges.yaml
  • /_templates/destinations/data-files/user-privileges.yml
Used in:
Repo link:
Instructions:

This template is used to add documentation about the privileges Stitch requires to connect to a database integration or destination.


Template sections

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

Defaults

A series of key-value pairs for permission names, doc links, and the reasons Stitch requires those permissions.

Parameter Description
names
OBJECT

A series of key-value pairs, where the key is a unique ID and the value is the name of the permission.

For example:

names:
  select: "SELECT"
doc-links
OBJECT

A series of key-value pairs, where the key is a unique ID and the value is a link to documentation about the permission, if there is any.

For example:

doc-links:
  select: "https://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html#priv_select"
reasons
OBJECT

A series of key-value pairs, where the key is a unique ID and the value is the reason why Stitch requires the permission.

For example:

reasons:
  select: "Required to select rows from tables in the specified schema."
Back to top

All permissions

Applicable only to destinations. A complete list of the permissions required by Stitch, where each permission is an item in a list named all-permissions:

## _data/destinations/postgres/user-privileges.yml

all-permissions:
  - name: *create-name
    reason: *create-reason
    doc-link: *create-doc-link

  - name: *select-information-schema-name
    reason: *select-reason
    schema: "information_schema"

  - name: *select-pg-catalog-schema-name
    reason: *select-reason
    schema: "pg_catalog"

Note: This example uses YAML references (*) to single-source data in the above file. Refer to the actual file to see how anchors and references are used.

Permission items in this list will contain the following properties:

Parameter Description
name
STRING

The name of the permission.

reason
STRING

The reason Stitch requires the permission.

doc-link
STRING

Optional. The link to documentation about the permission, if available/applicable.

Back to top

SQL commands

The SQL command section contains key-value pairs, where the key is a unique ID and the value is the SQL command used to grant the permission.

For example:

create-role: &create-role-sql |
  CREATE ROLE <stitch_role> COMMENT = 'Role for Stitch access';

While SQL commands can be bundled together under a single key, consider creating an item for each command. By doing this, you can reference a single command elsewhere (if needed) and provide additional context in the step of the user setup instructions that uses the command.

Back to top

Creation steps

Applicable only to destinations. In this section are the individual steps for creating a Stitch user for the destination.

The steps are items in a list that is named after the name of the destination, not its type. Each variant of the destination should have its own list, which means that this section can contain multiple creation step lists.

For example: Aurora PostgreSQL is based on PostgreSQL, so it would have a type of postgres. Its name, however, is aurora-postgres, so the list for Aurora PostgreSQL will be named aurora-postgres:

## _data/destinations/postgres/user-privileges.yml

aurora-postgres:
  - copy: *sql-client-copy
  - copy: *create-user-copy
    command: *create-user-sql
  - copy: *create-database-copy
    command: *create-database-sql
  - copy: *systems-tables-copy
    command: *select-systems-tables-sql

The _includes/destinations/templates/destination-user-setup.html include will loop through the list for the applicable destination and display the correct steps. Here’s an example.

Each item in the list can have the following parameters:

Parameter Description
copy
STRING

The copy for the step. This can be written in Markdown or HTML.

For example:

## _data/destinations/snowflake/user-privileges.yml

- copy: |
    Create a role for the Stitch user:
  command: *create-role-sql
command
STRING

If the step requires a SQL command, this parameter should contain the SQL command that must be executed.

For example:

## _data/destinations/snowflake/user-privileges.yml

- copy: |
    Create a role for the Stitch user:
  command: "CREATE ROLE [stitch_role] COMMENT = 'Role for Stitch access';"
Back to top
Back to top

Last updated: 30 July 2021