Datasource APIs
Update a datasource
Replace the credentials or tenancy of a datasource you already connected.
Use it to change a password, a host, or the tenancy setup. Databrain tests the new credentials and reads the schema again.
For trino, and for mssql or microsoft fabric with isDisableDatabase set to true and more than 25 databases, the call starts the schema read and returns before it ends. Poll the sync status with the datasource id until status.progress shows done equal to total. See Large schemas.
curl --request PUT https://api.usedatabrain.com/api/v2/datasource \ --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "datasourceType": "postgres", "credentials": { "name": "Sales warehouse", "host": "db.example.com", "port": 5432, "username": "databrain_reader", "password": "<new password>", "database": "analytics", "schema": "public" } }'Auth
A service token. See Authentication.
Limits
10 requests in 5 minutes per organization, shared with create, sync and schema discovery.
ApiTokenAuthorizationBearer <token>A service token or a data app API token.
Body
The body is the same as Create a datasource, with the same credential fields per type. These rules are different:
credentials.namepicks the datasource to update. You cannot rename a datasource with this call.credentialsreplaces all stored credentials. Send every required field again, not only the ones that change.datasourceTypeis used only to check and test the credentials. It does not change the type of the datasource. Send the type it already has.tenancySettingsis optional. If you leave it out, the stored tenancy stays. If you leave outtenancyLevel, the stored level stays.- When you send
tenancySettings, Databrain replaces the stored tenant table, its columns andclientColumnTypewith the values you send. A column you leave out is saved empty, andclientColumnTypebecomesSTRING. If you leave outschemaNameortableName, the saved table name is wrong. Send all of them again, not only the ones that change. - Microsoft Fabric (
microsoft fabric) can be updated here. It needsserver,portanddatabase.credentialsisMicrosoft Entra password(the default) orMicrosoft Entra service principal. WithMicrosoft Entra password, senduser,passwordandclientId. WithMicrosoft Entra service principal, sendclientId, andclientSecretorpassword.tenantId,isDisableDatabase,readOnlyIntentand the SSH fields are optional.
One of the types in Credentials by type, in lower case, or microsoft fabric.
snowflakepostgrespostgresqlcockroachdbredshiftmysqlmongodbclickhousesinglestorebigquerydatabrickselasticsearchopensearchmssqlawss3csvfireboltathenatrinomicrosoft fabricConnection fields for the type. credentials.name picks the datasource to update.
52 fields in credentials
The name of the datasource to update, exactly as saved.
For postgres, mysql, mongodb, clickhouse, singlestore, snowflake, trino. See Credentials by type.
For postgres, mysql, mongodb, clickhouse, singlestore, mssql, microsoft fabric, trino. See Credentials by type.
For postgres, snowflake, trino. See Credentials by type.
For postgres, mysql, mongodb, clickhouse, singlestore, mssql, microsoft fabric, snowflake, elasticsearch, opensearch, trino. See Credentials by type.
For postgres, singlestore, mssql, microsoft fabric, snowflake, athena, firebolt. See Credentials by type.
For postgres, snowflake, firebolt, trino. See Credentials by type.
For postgres. See Credentials by type.
For postgres, mssql, microsoft fabric, trino. See Credentials by type.
enabledisableFor postgres, mssql, microsoft fabric, trino. See Credentials by type.
For postgres, mssql, microsoft fabric, trino. See Credentials by type.
For postgres, mssql, microsoft fabric, trino. See Credentials by type.
For postgres, mssql, microsoft fabric, trino. See Credentials by type.
For mysql, mongodb, clickhouse, singlestore, mssql, microsoft fabric. See Credentials by type.
For mssql, microsoft fabric. See Credentials by type.
For mssql, microsoft fabric. See Credentials by type.
For mssql, microsoft fabric. See Credentials by type.
For snowflake. See Credentials by type.
For snowflake. See Credentials by type.
For snowflake, databricks, microsoft fabric. See Credentials by type.
For snowflake. See Credentials by type.
For snowflake. See Credentials by type.
For bigquery. See Credentials by type.
For bigquery. See Credentials by type.
For bigquery. See Credentials by type.
For bigquery. See Credentials by type.
For databricks. See Credentials by type.
For databricks. See Credentials by type.
For databricks. See Credentials by type.
For databricks, microsoft fabric. See Credentials by type.
For microsoft fabric. Optional.
For databricks, microsoft fabric. See Credentials by type.
For elasticsearch, opensearch. See Credentials by type.
elastic-cloudopen-cloudself-managedFor elasticsearch, opensearch. See Credentials by type.
For elasticsearch, opensearch. See Credentials by type.
For elasticsearch, opensearch. See Credentials by type.
For elasticsearch, opensearch. See Credentials by type.
For awss3. See Credentials by type.
For awss3. See Credentials by type.
For awss3, athena. See Credentials by type.
For awss3, athena. See Credentials by type.
For awss3, athena. See Credentials by type.
For athena. See Credentials by type.
For firebolt. See Credentials by type.
For firebolt. See Credentials by type.
For firebolt. See Credentials by type.
For firebolt. See Credentials by type.
For trino. See Credentials by type.
athena only. Optional.
Tenancy for this datasource.
6 fields in tenancySettings
TABLE (a tenant column) or DATABASE (a schema or database per tenant)
Required for TABLE. Schema of the table that lists your tenants.
Required for TABLE. Table that lists your tenants.
Required for TABLE. Column with the tenant name.
Required for TABLE. Column with the tenant id, the value you send as clientId
Response
{ "name": "Sales warehouse"}The response can also have warnings, as on create.
Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | A field is missing, unknown or wrong, or the host is refused |
| 400 | DATASOURCE_NAME_ERROR | No datasource has this credentials.name |
| 400 | DATASOURCE_NOT_FOUND | The datasource was removed while you updated it |
| 400 | CREDENTIAL_TEST_FAILED | Databrain could not connect with the new credentials. Nothing was changed |
| 400 | TENANCY_SETTINGS_CREATE_FAILED or TENANCY_SETTINGS_UPDATE_FAILED | The credentials were saved, the tenancy was not |
| 400 | SCHEMA_CACHE_FAILED | Credentials and tenancy were saved, the schema was not read. Run sync |
| 403 | DATABRICKS_OAUTH_NOT_ENABLED | Databricks OAuth is not on for your organization |
| 429 | Rate limit |
The steps are not one transaction. A later step can fail after an earlier one is saved.
For errors that every endpoint returns, see Authentication.
curl -X PUT 'https://api.usedatabrain.com/api/v2/datasource' \ -H 'Content-Type: application/json' \ -d '{ "datasourceType": "postgres", "credentials": { "name": "Sales warehouse", "host": "db.example.com", "port": 5432, "username": "databrain_reader", "password": "<new password>", "database": "analytics", "schema": "public" }}'{ "name": "Sales warehouse"}