Skip to main content

user_memberships

Creates, updates, deletes, gets or lists a user_memberships resource.

Overview​

Nameuser_memberships
TypeResource
Idfivetran.teams.user_memberships

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
user_idstringThe unique identifier of user (example: user_id)
created_atstring (date-time)The date and time the membership was created (example: 2023-08-20T10:15:20.677566Z)
rolestringThe user's role within the team (example: Team Member)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectteam_id, user_idReturns the membership details for a user in a team.
listselectteam_idcursor, limit, activeReturns a list of users and their roles within a team in your Fivetran account
createinsertteam_id, user_idAssigns a role for a user in a team.
updateupdateteam_id, user_id, roleUpdates a user membership in a team.
deletedeleteteam_id, user_idRemoves 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.

NameDatatypeDescription
team_idstringThe unique identifier for the team within the account.
user_idstringThe unique identifier for the user within the account.
activebooleanIndicates whether to return only enabled users (true) or not (false). By default, both enabled (allowed to log in) and suspended users are returned.
cursorstringPaging cursor, [read more about pagination](https:​//fivetran.com/docs/rest-api/pagination)
limitinteger (int32)Number of records to fetch per page. Accepts a number in the range 1..1000; the default value is 100.

SELECT examples​

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
;

INSERT examples​

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
;

UPDATE examples​

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​

Removes a user from a team.

DELETE FROM fivetran.teams.user_memberships
WHERE team_id = '{{ team_id }}' --required
AND user_id = '{{ user_id }}' --required
;