Connect and Visualize Live Bitbucket Data in Databricks Lakehouse Federation with CData Connect AI

Dibyendu Datta
Dibyendu Datta
Lead Technology Evangelist
Use CData Connect AI to integrate live Bitbucket data into the Databricks platform and create visualization dashboards with real-time Bitbucket data.

Databricks Lakehouse Federation enables organizations to query and integrate data from multiple sources without requiring data movement. It allows federated queries across databases, data warehouses, and lakehouses, providing a unified interface for data analysis and management within Databricks. When combined with CData Connect AI, it enables seamless access to Bitbucket data for data virtualization, while also supporting data lineage and fine-grained access control.

This article explains how to use CData Connect AI to establish a live connection to Bitbucket and how to access live Bitbucket data from the Databricks platform.

CData Connect AI offers a seamless SQL Server, cloud-to-cloud interface for Bitbucket, enabling you to effortlessly create dashboards and visualizations using live Bitbucket data in Databricks. While building visualizations, Databricks requires SQL queries to retrieve the necessary data. With built-in optimized data processing, CData Connect AI pushes all supported SQL operations (such as filters and JOINs) directly to Bitbucket, utilizing server-side processing for fast and efficient data retrieval of Bitbucket data.

Configure Bitbucket connectivity for Databricks in CData Connect AI

To work with Bitbucket data in Databricks - Lakehouse Federation, you need to connect to Bitbucket from Connect AI and provide user access to the connection.

  1. Log into Connect AI, click Sources, and then click Add Connection
  2. Adding a Connection
  3. Select "Bitbucket" from the Add Connection panel
  4. Selecting a data source
  5. Enter the necessary authentication properties to connect to Bitbucket.

    For most queries, you must set the Workspace. The only exception to this is the Workspaces table, which does not require this property to be set, as querying it provides a list of workspace slugs that can be used to set Workspace. To query this table, you must set Schema to 'Information' and execute the query SELECT * FROM Workspaces>.

    Setting Schema to 'Information' displays general information. To connect to Bitbucket, set these parameters:

    • Schema: To show general information about a workspace, such as its users, repositories, and projects, set this to Information. Otherwise, set this to the schema of the repository or project you are querying. To get a full set of available schemas, query the sys_schemas table.
    • Workspace: Required if you are not querying the Workspaces table. This property is not required for querying the Workspaces table, as that query only returns a list of workspace slugs that can be used to set Workspace.

    Authenticating to Bitbucket

    Bitbucket supports OAuth authentication only. To enable this authentication from all OAuth flows, you must create a custom OAuth application, and set AuthScheme to OAuth.

    Be sure to review the Help documentation for the required connection properties for you specific authentication needs (desktop applications, web applications, and headless machines).

    Creating a custom OAuth application

    From your Bitbucket account:

    1. Go to Settings (the gear icon) and select Workspace Settings.
    2. In the Apps and Features section, select OAuth Consumers.
    3. Click Add Consumer.
    4. Enter a name and description for your custom application.
    5. Set the callback URL:
      • For desktop applications and headless machines, use http://localhost:33333 or another port number of your choice. The URI you set here becomes the CallbackURL property.
      • For web applications, set the callback URL to a trusted redirect URL. This URL is the web location the user returns to with the token that verifies that your application has been granted access.
    6. If you plan to use client credentials to authenticate, you must select This is a private consumer. In the driver, you must set AuthScheme to client.
    7. Select which permissions to give your OAuth application. These determine what data you can read and write with it.
    8. To save the new custom application, click Save.
    9. After the application has been saved, you can select it to view its settings. The application's Key and Secret are displayed. Record these for future use. You will use the Key to set the OAuthClientId and the Secret to set the OAuthClientSecret.
    Configuring a connection (Salesforce is shown)
  6. Click Save & Test
  7. Navigate to the Permissions tab in the Add Bitbucket Connection page and update the User-based permissions. Updating permissions

Add a Personal Access Token

When connecting to Connect AI through the REST API, the OData API, or the Virtual SQL Server, a Personal Access Token (PAT) is used to authenticate the connection to Connect AI. It is best practice to create a separate PAT for each service to maintain granularity of access.

  1. Click on the Gear icon () at the top right of the Connect AI app to open the settings page.
  2. On the Settings page, go to the Access Tokens section and click Create PAT.
  3. Give the PAT a name and click Create. Creating a new PAT
  4. The personal access token is only visible at creation, so be sure to copy it and store it securely for future use.

With the connection configured and a PAT generated, you are ready to connect to Bitbucket data from Databricks.

Connecting live Bitbucket data in Databricks

Follow these steps to establish a connection from Databricks to the CData Connect AI Virtual SQL Server API.

  1. Log into Databricks.
  2. Navigate to SQL Warehouses and start any warehouse of your choice. Start SQL Warehouse
  3. In the navigation pane, select Catalog. Click and select Create a connection. Create a connection
  4. In the Connection basics section (or Step 1 of Set up connection page), enter the following connection details and click Next:
    • Connection name: a user-defined connection name.
    • Connection type: select SQL Server from the drop-down list.
    • Auth type: select Username and password.
    Add connection basics details
  5. In the Authentication section (or Step 2), enter the required authentication details, and click Next:
    • Host: tds.cdata.com
    • Port: 14333
    • User: enter your CData Connect AI username, displayed in the top-right corner of the CData Connect AI interface. For example, [email protected]
    • Password: enter the PAT generated and copied in the previous section.
    Add authentication details
  6. In the Connection details section (or Step 3), enable the Trust server certificate checkbox and select the appropriate Application intent. Click Create Connection. Add connection details
  7. In the Catalog basics section (or Step 4), enter the required details and click Create catalog:
    • Catalog name: enter a name of your choice
    • Connection: this will be the Databricks connection you defined earlier
    • Database: enter your Bitbucket connection name (for example, Bitbucket1)
    Add catalog basics details
  8. In the Access section (or Step 5), assign the Workspace, User access rights, and Grant read or edit privileges to the catalog. Add the access rights Grant the access rights
  9. Click Next > Save to save all the details for the catalog. Save the catalog details and set up the connection

Access the catalog and visualize live Bitbucket data in Databricks

To access the newly created catalog and create a dashboard to visualize live Bitbucket data in Databricks, follow these steps:

  1. Select the catalog and expand it. A list of tables from Bitbucket will appear on the screen. Select and expand the catalog
  2. Choose the desired table and click the Overview tab to view the table metadata. Select Overview View the table metadata
  3. Click the Sample Data tab to view real-time data in the table. Select Sample Data to view the table data
  4. Now, click Create at the top right corner and select Dashboard. Create a new dashboard
  5. Manually create a visualization by selecting at least one field in the visualization editor from the widget, or choose one of the visualization options suggested by Databricks AI. Create the dashboard manually or using the Databricks AI
  6. Once the visualization is created, edit the details in the widget settings of the dashboard. Visualization is created
  7. Click Publish to publish the dashboard report. Publish the dashboard

Live access to Bitbucket data from cloud applications

At this stage, you have established a direct, cloud-to-cloud connection to live Bitbucket data in Databricks. This enables you to create dashboards to monitor and visualize your data seamlessly.

For more details on accessing live data from over 100 SaaS, Big Data, and NoSQL sources through cloud applications like Databricks, visit our Connect AI page. As always, let us know if you have any questions during your evaluation. Our world-class CData Support Team is always available to help!

Ready to get started?

Learn more about CData Connect AI or sign up for free trial access:

Free Trial