New: build custom CDF applications with Cognite Flows. Documentation · What's new.
import os
from cognite.client.data_classes.postgres_gateway import UserUpdate, SessionCredentials
from cognite.client.data_classes import ClientCredentials
session = client.iam.sessions.create(
ClientCredentials(os.environ["IDP_CLIENT_ID"], os.environ["IDP_CLIENT_SECRET"]),
session_type="CLIENT_CREDENTIALS"
)
update = UserUpdate('myUser').credentials.set(SessionCredentials(nonce=session.nonce))
res = client.postgres_gateway.users.update(update){
"items": [
{
"username": "<string>",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"sessionId": 4503599627370496
}
],
"nextCursor": "<string>"
}Required capabilities:
[object Object]
Update postgres users
import os
from cognite.client.data_classes.postgres_gateway import UserUpdate, SessionCredentials
from cognite.client.data_classes import ClientCredentials
session = client.iam.sessions.create(
ClientCredentials(os.environ["IDP_CLIENT_ID"], os.environ["IDP_CLIENT_SECRET"]),
session_type="CLIENT_CREDENTIALS"
)
update = UserUpdate('myUser').credentials.set(SessionCredentials(nonce=session.nonce))
res = client.postgres_gateway.users.update(update){
"items": [
{
"username": "<string>",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"sessionId": 4503599627370496
}
],
"nextCursor": "<string>"
}Documentation Index
Fetch the complete documentation index at: https://docs.cognite.com/llms.txt
Use this file to discover all available pages before exploring further.
Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
Users to update
1 elementShow child attributes
Was this page helpful?