This repository contains the Python client library for CData Connect AI and the companion mock server used for development and testing.
connect-ai-python/
├── connector/ # Python DB-API 2.0 connector (the installable package)
├── connect-ai-mock/ # Mock API server for local development and testing
└── .gitignore
A Python DB-API 2.0 (PEP 249) compliant connector for CData Connect AI. Install it, point it at a Connect AI endpoint, and query any connected data source using standard Python database idioms.
See connector/README.md for full documentation.
pip install cdata-connect-aiA FastAPI-based mock server that simulates the Connect AI Query APIs. Used for:
- Running the connector's test suite locally without a live endpoint
- Developing and testing against edge cases (errors, timeouts, large datasets, streaming)
See connect-ai-mock/README.md for full documentation.
cd connect-ai-mock
pip install -r requirements.txt
python run.pyFrom the connector/ directory:
pip install build
python -m buildThis produces two artifacts in connector/dist/:
| File | Purpose |
|---|---|
cdata_connect_ai-1.0.0-py3-none-any.whl |
Wheel — install with pip install |
cdata_connect_ai-1.0.0.tar.gz |
Source distribution — for PyPI upload |
Install the wheel locally:
pip install connector/dist/cdata_connect_ai-1.0.0-py3-none-any.whlPublish to PyPI:
pip install twine
twine check connector/dist/* # verify metadata
twine upload connector/dist/* # upload (requires PyPI token)See connector/README.md for full build and publish details.
client_demo.py (at the repo root) exercises the connector end-to-end against the mock server — SELECT, INSERT, DELETE, stored procedures, error handling, and more.
Step 1 — Start the mock server:
cd connect-ai-mock
pip install -r requirements.txt
python run.pyStep 2 — Run the demo (from the repo root, in a second terminal):
pip install cdata-connect-ai # from PyPI
# or: pip install connector/dist/cdata_connect_ai-1.0.0-py3-none-any.whl
python client_demo.pyFrom the connector/ directory:
pip install -e ".[dev]"
# Unit tests only — fast, no server needed
pytest tests/unit/ -v
# Integration tests — mock server auto-starts on localhost
pytest tests/integration/ -v
# All tests
pytest tests/ -vSee connector/tests/README.md for full test organization details.
- Python >= 3.10