New: build custom CDF applications with Cognite Flows. Documentation · What's new.
import os
from cognite.client.data_classes.postgres_gateway import UserWrite, 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"
)
user = UserWrite(credentials=SessionCredentials(nonce=session.nonce))
res = client.postgres_gateway.users.create(user){
"items": [
{
"host": "fdw.<CLUSTER>.cogniteapp.com",
"username": "<string>",
"password": "<string>",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"sessionId": 4503599627370496
}
]
}Required capabilities:
postgresGateway:WRITE
Create postgres users.
import os
from cognite.client.data_classes.postgres_gateway import UserWrite, 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"
)
user = UserWrite(credentials=SessionCredentials(nonce=session.nonce))
res = client.postgres_gateway.users.create(user){
"items": [
{
"host": "fdw.<CLUSTER>.cogniteapp.com",
"username": "<string>",
"password": "<string>",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"sessionId": 4503599627370496
}
]
}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.
List of postgres users to create
1 elementShow child attributes
List of created users
1 elementShow child attributes
Was this page helpful?