Forum Discussion

rafaesanto83's avatar
rafaesanto83
Frequent Visitor
3 years ago
Solved

Error to create a Databricks datasource using Power BI Rest API

I successfuly used the "Gateways - Create Datasource" (https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource) method from Power BI Rest API to create a SQL datasource, but I´m stuck when I try to create a Databricks datasource.

I saw that there is no Databricks datasource kind, but it could be possible to use the kind "Extension". So a try this code:

 

OBS: I generated the credential part using the data gateway publick key and a Databricks key.

 

{
    "datasourceName": "Databricks AIDA Teste",
    "datasourceType":"Extension",
         "connectionDetails":{
            "path":"{\"host\":\"adb-xxx.azuredatabricks.net\",\"httpPath\":\"\\/sql\\/1.0\\/warehouses\\/xxx\"}",
            "kind":"Databricks"
         },
    "credentialDetails": {
        "credentialType": "Key",
        "credentials": "xxx",
        "privacyLevel": "Organizational"
    }
}

 

And get this error:

 

{
    "error": {
        "code": "BadRequest",
        "message": "Bad Request",
        "details": [
            {
                "message": "Unexpected character encountered while parsing value: {. Path 'connectionDetails', line 4, position 30.",
                "target": "datasourceToGatewayRequest.connectionDetails"
            },
            {
                "message": "'datasourceToGatewayRequest' is a required parameter",
                "target": "datasourceToGatewayRequest"
            }
        ]
    }
}

 

What am I missing, or doing wrong?

  • Hello, Anonymous!

     

    {
        "dataSourceType": "Extension",
        "connectionDetails": "{\"extensionDataSourceKind\":\"Databricks\",\"extensionDataSourcePath\":\"{\\\"host\\\":\\\"adbXXX.2.azuredatabricks.net\\\",\\\"httpPath\\\":\\\"\\\\/sql\\\\/1.0\\\\/warehouses\\\\/YYYYYY\\\"}\"}",
        "datasourceName": "Azure Databricks AIDA API REST v4 (D9T5) TESTE",
        "credentialDetails": {
            "credentialType": "Key",
    "credentials": "XX=",
            "encryptedConnection": "Encrypted",
            "encryptionAlgorithm": "RSA-OAEP",
            "privacyLevel": "Organizational"
        }
    }

     The issue are related with some missing slashes. This version works well!

2 Replies

Replies have been turned off for this discussion
  • Anonymous's avatar
    Anonymous
    Not applicable

    rafaesanto83  Did you find a solution to this? I am trying to pull data from PowerBI (user input from sliders on a visual) to Databricks. I thought your solution might be one peice of the puzzle. Thanks!

    • rafaesanto83's avatar
      rafaesanto83
      Frequent Visitor

      Hello, Anonymous!

       

      {
          "dataSourceType": "Extension",
          "connectionDetails": "{\"extensionDataSourceKind\":\"Databricks\",\"extensionDataSourcePath\":\"{\\\"host\\\":\\\"adbXXX.2.azuredatabricks.net\\\",\\\"httpPath\\\":\\\"\\\\/sql\\\\/1.0\\\\/warehouses\\\\/YYYYYY\\\"}\"}",
          "datasourceName": "Azure Databricks AIDA API REST v4 (D9T5) TESTE",
          "credentialDetails": {
              "credentialType": "Key",
      "credentials": "XX=",
              "encryptedConnection": "Encrypted",
              "encryptionAlgorithm": "RSA-OAEP",
              "privacyLevel": "Organizational"
          }
      }

       The issue are related with some missing slashes. This version works well!