Connect AI Python SDK
DB-API 2.0 client for Connect AI. Works with pandas, SQLAlchemy, and any Python data tool.
$ pip install cdata-connect-ai
import cdata_connect_ai
# Same pattern as psycopg2, sqlite3, etc.
conn = cdata_connect_ai.connect(
username="[email protected]",
password="<your_pat>",
)
cur = conn.cursor()
cur.execute("SELECT * FROM [Workday].[Workday].[Worker] LIMIT 5")
for row in cur:
print(row)
conn.close()
First query in 5 minutes
From pip install to a working query in four steps.
1. Install
pip install cdata-connect-ai
2. Get a Personal Access Token
In cloud.cdata.com, click the gear icon (top-right) → Access Tokens → Create PAT. Copy the token immediately, it’s only shown once.
3. Connect and discover
Connect with your email and PAT, then query sys_tables to see every table available across your connected sources:
import cdata_connect_ai
conn = cdata_connect_ai.connect(
username="[email protected]",
password="<your_pat>",
)
cur = conn.cursor()
cur.execute("SELECT CatalogName, SchemaName, TableName FROM sys_tables LIMIT 25")
for row in cur.fetchall():
print(row)
4. Query a real table
Pick any table from step 3 and query it directly. Identifiers are three-part: [Catalog].[Schema].[Table].
cur.execute("""
SELECT *
FROM [Salesforce].[Salesforce].[Account]
LIMIT 5
""")
for row in cur.fetchall():
print(row)
conn.close()
Quick reference
The full DB-API 2.0 surface. Familiar shapes, consistent across hundreds of sources.
connect()
Open a connection with username and password (personal access token), optional workspace, and timeout overrides.
cursor.description
Column metadata after execute(). Names, types, nullability.
cursor.execute()
Parameterized SQL queries. Identifiers are quoted; values are bound.
Query sys_catalogs, sys_schemas, and sys_tables to discover what’s connected.
cursor.fetchone() / fetchall() / fetchmany()
Standard result iteration. Streaming variants available for large result sets.
PEP 249-compliant exceptions: OperationalError, ProgrammingError, DatabaseError, and more.
Install
MIT-licensed. Source on GitHub, releases on PyPI.
pip install cdata-connect-ai
DB-API 2.0 client for the Connect AI query API. Pythonic, typed, async-aware.
Full API reference, authentication guides, and configuration details.