Skip to main content
See the cdata-connect-ai PyPI page for more information.

Prerequisites

Before you can configure and use Python with Connect AI, you must have the following:
  • Python >=3.10
  • requests >= 2.28.0
  • ijson >= 3.1.0
  • A data source in your Connect AI account. See Sources for more information.
  • A Personal Access Token (PAT). Generate a PAT on the Settings page. Copy this down, as it acts as your password during authentication.

Install the Connector

For pandas integration: install the connector with the full extra to enable pandas support.

Connect to Connect AI

The following is an example of Python code connecting to the Connect AI API and performing a query on the Account table in a Salesforce connection. Provide your Connect AI username and password (the password is the PAT you created in the prerequisites).

Configuration File

Use a PyHOCON configuration file to keep credentials out of code:
The code now refers to the configuration file and does not contain credentials:

Connect to a Workspace

To connect to a Connect AI workspace, add a workspace parameter as follows:

Examples

Parameterized Queries

Batch Operations

See Data Types for dataType values and descriptions.

Stored Procedures

Pandas Integration

Connection Options

The following table contains the connection options available for the connector.