user_memberships
Creates, updates, deletes, gets or lists a user_memberships resource.
Overview
| Name | user_memberships |
| Type | Resource |
| Id | fivetran.teams.user_memberships |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
user_id | string | The unique identifier of user (example: user_id) |
created_at | string (date-time) | The date and time the membership was created (example: 2023-08-20T10:15:20.677566Z) |
role | string | The user's role within the team (example: Team Member) |
| Name | Datatype | Description |
|---|---|---|
user_id | string | The unique identifier of user (example: user_id) |
created_at | string (date-time) | The date and time the membership was created (example: 2023-08-20T10:15:20.677566Z) |
role | string | The user's role within the team (example: Team Member) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | team_id, user_id | Returns the membership details for a user in a team. | |
list | select | team_id | cursor, limit, active | Returns a list of users and their roles within a team in your Fivetran account |
create | insert | team_id, user_id | Assigns a role for a user in a team. | |
update | update | team_id, user_id, role | Updates a user membership in a team. | |
delete | delete | team_id, user_id | Removes a user from a team. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
team_id | string | The unique identifier for the team within the account. |
user_id | string | The unique identifier for the user within the account. |
active | boolean | Indicates whether to return only enabled users (true) or not (false). By default, both enabled (allowed to log in) and suspended users are returned. |
cursor | string | Paging cursor, [read more about pagination](https://fivetran.com/docs/rest-api/pagination) |
limit | integer (int32) | Number of records to fetch per page. Accepts a number in the range 1..1000; the default value is 100. |
SELECT examples
- get
- list
Returns the membership details for a user in a team.
SELECT
user_id,
created_at,
role
FROM fivetran.teams.user_memberships
WHERE team_id = '{{ team_id }}' -- required
AND user_id = '{{ user_id }}' -- required
;
Returns a list of users and their roles within a team in your Fivetran account
SELECT
user_id,
created_at,
role
FROM fivetran.teams.user_memberships
WHERE team_id = '{{ team_id }}' -- required
AND "limit" = '{{ limit }}'
AND active = '{{ active }}'
;
INSERT examples
- create
- Manifest
Assigns a role for a user in a team.
INSERT INTO fivetran.teams.user_memberships (
user_id,
role,
team_id
)
SELECT
'{{ user_id }}' /* required */,
'{{ role }}',
'{{ team_id }}'
RETURNING
user_id,
created_at,
role
;
# Description fields are for documentation purposes
- name: user_memberships
props:
- name: team_id
value: "{{ team_id }}"
description: Required parameter for the user_memberships resource.
- name: user_id
value: "{{ user_id }}"
description: |
The unique identifier of user
- name: role
value: "{{ role }}"
description: |
The user's role within the team
UPDATE examples
- update
Updates a user membership in a team.
UPDATE fivetran.teams.user_memberships
SET
role = '{{ role }}'
WHERE
team_id = '{{ team_id }}' --required
AND user_id = '{{ user_id }}' --required
AND role = '{{ role }}' --required
RETURNING
user_id,
created_at,
role;
DELETE examples
- delete
Removes a user from a team.
DELETE FROM fivetran.teams.user_memberships
WHERE team_id = '{{ team_id }}' --required
AND user_id = '{{ user_id }}' --required
;