datus-clickzetta 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datus_clickzetta-0.1.0/.gitignore +137 -0
- datus_clickzetta-0.1.0/PKG-INFO +409 -0
- datus_clickzetta-0.1.0/README.md +386 -0
- datus_clickzetta-0.1.0/datus_clickzetta/__init__.py +47 -0
- datus_clickzetta-0.1.0/datus_clickzetta/config.py +32 -0
- datus_clickzetta-0.1.0/datus_clickzetta/connector.py +941 -0
- datus_clickzetta-0.1.0/examples/agent.clickzetta.yml.example +120 -0
- datus_clickzetta-0.1.0/pyproject.toml +41 -0
- datus_clickzetta-0.1.0/test.py +25 -0
- datus_clickzetta-0.1.0/tests/FINAL_TEST_REPORT.md +164 -0
- datus_clickzetta-0.1.0/tests/README.md +221 -0
- datus_clickzetta-0.1.0/tests/__init__.py +3 -0
- datus_clickzetta-0.1.0/tests/comprehensive_test.py +130 -0
- datus_clickzetta-0.1.0/tests/conftest.py +197 -0
- datus_clickzetta-0.1.0/tests/integration/test_connector_integration.py +387 -0
- datus_clickzetta-0.1.0/tests/pytest.ini +16 -0
- datus_clickzetta-0.1.0/tests/run_tests.py +160 -0
- datus_clickzetta-0.1.0/tests/unit/test_config.py +236 -0
- datus_clickzetta-0.1.0/tests/unit/test_utils.py +317 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter Notebook
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# IPython
|
|
79
|
+
profile_default/
|
|
80
|
+
ipython_config.py
|
|
81
|
+
|
|
82
|
+
# pyenv
|
|
83
|
+
.python-version
|
|
84
|
+
|
|
85
|
+
# pipenv
|
|
86
|
+
Pipfile.lock
|
|
87
|
+
|
|
88
|
+
# uv
|
|
89
|
+
uv.lock
|
|
90
|
+
|
|
91
|
+
# PEP 582
|
|
92
|
+
__pypackages__/
|
|
93
|
+
|
|
94
|
+
# Celery stuff
|
|
95
|
+
celerybeat-schedule
|
|
96
|
+
celerybeat.pid
|
|
97
|
+
|
|
98
|
+
# SageMath parsed files
|
|
99
|
+
*.sage.py
|
|
100
|
+
|
|
101
|
+
# Environments
|
|
102
|
+
.env
|
|
103
|
+
.venv
|
|
104
|
+
env/
|
|
105
|
+
venv/
|
|
106
|
+
ENV/
|
|
107
|
+
env.bak/
|
|
108
|
+
venv.bak/
|
|
109
|
+
|
|
110
|
+
# Spyder project settings
|
|
111
|
+
.spyderproject
|
|
112
|
+
.spyproject
|
|
113
|
+
|
|
114
|
+
# Rope project settings
|
|
115
|
+
.ropeproject
|
|
116
|
+
|
|
117
|
+
# mkdocs documentation
|
|
118
|
+
/site
|
|
119
|
+
|
|
120
|
+
# mypy
|
|
121
|
+
.mypy_cache/
|
|
122
|
+
.dmypy.json
|
|
123
|
+
dmypy.json
|
|
124
|
+
|
|
125
|
+
# Pyre type checker
|
|
126
|
+
.pyre/
|
|
127
|
+
|
|
128
|
+
# IDEs
|
|
129
|
+
.vscode/
|
|
130
|
+
.idea/
|
|
131
|
+
*.swp
|
|
132
|
+
*.swo
|
|
133
|
+
*~
|
|
134
|
+
|
|
135
|
+
# OS
|
|
136
|
+
.DS_Store
|
|
137
|
+
Thumbs.db
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: datus-clickzetta
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ClickZetta database adapter for Datus
|
|
5
|
+
Project-URL: Homepage, https://github.com/Datus-ai/datus-db-adapters
|
|
6
|
+
Project-URL: Repository, https://github.com/Datus-ai/datus-db-adapters
|
|
7
|
+
Project-URL: Issues, https://github.com/Datus-ai/datus-db-adapters/issues
|
|
8
|
+
Author-email: DatusAI <support@datus.ai>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
Keywords: adapter,clickzetta,database,datus,lakehouse
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Requires-Dist: clickzetta-connector-python
|
|
18
|
+
Requires-Dist: clickzetta-zettapark-python
|
|
19
|
+
Requires-Dist: datus-agent>=0.2.1
|
|
20
|
+
Requires-Dist: pandas>=2.0.0
|
|
21
|
+
Requires-Dist: pyarrow>=10.0.0
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Datus ClickZetta Adapter
|
|
25
|
+
|
|
26
|
+
This package provides a [ClickZetta](https://www.singdata.com/) Lakehouse adapter for [Datus](https://github.com/Datus-ai/datus-agent), enabling seamless integration with ClickZetta analytics platform.
|
|
27
|
+
|
|
28
|
+
[ClickZetta](https://www.singdata.com/) is developed by [Singdata](https://www.singdata.com/) and [Yunqi](https://www.yunqi.tech/).
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install datus-clickzetta
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Dependencies
|
|
37
|
+
|
|
38
|
+
This adapter requires the following ClickZetta Python packages:
|
|
39
|
+
- `clickzetta-connector-python`
|
|
40
|
+
- `clickzetta-zettapark-python`
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
Configure ClickZetta connection in your Datus configuration. A complete example is available at [`examples/agent.clickzetta.yml.example`](examples/agent.clickzetta.yml.example).
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
namespace:
|
|
48
|
+
clickzetta_prod:
|
|
49
|
+
type: clickzetta
|
|
50
|
+
service: "your-service-endpoint.clickzetta.com"
|
|
51
|
+
username: "your-username"
|
|
52
|
+
password: "your-password"
|
|
53
|
+
instance: "your-instance-id"
|
|
54
|
+
workspace: "your-workspace"
|
|
55
|
+
schema: "PUBLIC" # optional, defaults to PUBLIC
|
|
56
|
+
vcluster: "DEFAULT_AP" # optional, defaults to DEFAULT_AP
|
|
57
|
+
secure: false # optional
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Configuration Parameters
|
|
61
|
+
|
|
62
|
+
| Parameter | Type | Required | Default | Description |
|
|
63
|
+
|-----------|------|----------|---------|-------------|
|
|
64
|
+
| `service` | string | Yes | - | ClickZetta service endpoint |
|
|
65
|
+
| `username` | string | Yes | - | ClickZetta username |
|
|
66
|
+
| `password` | string | Yes | - | ClickZetta password |
|
|
67
|
+
| `instance` | string | Yes | - | ClickZetta instance identifier |
|
|
68
|
+
| `workspace` | string | Yes | - | ClickZetta workspace name |
|
|
69
|
+
| `schema` | string | No | "PUBLIC" | Default schema name |
|
|
70
|
+
| `vcluster` | string | No | "DEFAULT_AP" | Virtual cluster name |
|
|
71
|
+
| `secure` | boolean | No | null | Enable secure connection |
|
|
72
|
+
| `hints` | object | No | {} | Additional connection hints |
|
|
73
|
+
| `extra` | object | No | {} | Extra connection parameters |
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- **Full SQL Support**: Execute queries, DDL, DML operations
|
|
78
|
+
- **Metadata Discovery**: Automatic discovery of databases, schemas, tables, and views
|
|
79
|
+
- **Volume Integration**: Read files from ClickZetta volumes
|
|
80
|
+
- **Sample Data**: Extract sample rows for data profiling
|
|
81
|
+
- **Connection Management**: Automatic connection pooling and session management
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
Once installed and configured, use the ClickZetta adapter with Datus:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
# Execute queries
|
|
89
|
+
result = agent.query("SELECT * FROM my_table LIMIT 10")
|
|
90
|
+
|
|
91
|
+
# Get table information
|
|
92
|
+
tables = agent.get_tables("my_schema")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Volume Operations
|
|
96
|
+
|
|
97
|
+
The adapter supports reading files from ClickZetta volumes:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
# Read a file from a volume
|
|
101
|
+
content = connector.read_volume_file("volume:user://my_volume", "path/to/file.yaml")
|
|
102
|
+
|
|
103
|
+
# List files in a volume directory
|
|
104
|
+
files = connector.list_volume_files("volume:user://my_volume", "config/", suffixes=(".yaml", ".yml"))
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Connection Hints
|
|
108
|
+
|
|
109
|
+
You can customize ClickZetta connection behavior using hints:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
namespace:
|
|
113
|
+
clickzetta_prod:
|
|
114
|
+
type: clickzetta
|
|
115
|
+
# ... other connection parameters
|
|
116
|
+
hints:
|
|
117
|
+
sdk.job.timeout: 600
|
|
118
|
+
query_tag: "Datus Analytics Query"
|
|
119
|
+
cz.storage.parquet.vector.index.read.memory.cache: "true"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Error Handling
|
|
123
|
+
|
|
124
|
+
The adapter provides comprehensive error handling with detailed error messages for common issues:
|
|
125
|
+
|
|
126
|
+
- Connection failures
|
|
127
|
+
- Authentication errors
|
|
128
|
+
- Query execution errors
|
|
129
|
+
- Schema/workspace switching limitations
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
### Development Mode Setup (Complete Guide)
|
|
134
|
+
|
|
135
|
+
This guide covers the complete setup from Datus agent installation to ClickZetta adapter development and testing.
|
|
136
|
+
|
|
137
|
+
#### Prerequisites
|
|
138
|
+
- Python 3.11+ recommended
|
|
139
|
+
- Git
|
|
140
|
+
|
|
141
|
+
#### Step 1: Setup Datus Agent Development Environment
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Clone the Datus agent repository
|
|
145
|
+
git clone https://github.com/Datus-ai/datus-agent.git
|
|
146
|
+
cd datus-agent
|
|
147
|
+
|
|
148
|
+
# Create and activate virtual environment
|
|
149
|
+
python -m venv .venv
|
|
150
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
151
|
+
|
|
152
|
+
# Install Datus agent in editable mode
|
|
153
|
+
pip install -e .
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Step 2: Clone and Install ClickZetta Adapter
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# From your development directory
|
|
160
|
+
git clone https://github.com/Datus-ai/datus-db-adapters.git
|
|
161
|
+
cd datus-db-adapters/datus-clickzetta
|
|
162
|
+
|
|
163
|
+
# Install ClickZetta adapter in editable mode (using the same virtual environment)
|
|
164
|
+
pip install -e .
|
|
165
|
+
|
|
166
|
+
# Verify installation
|
|
167
|
+
pip show datus-clickzetta
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Step 3: Configure Environment Variables
|
|
171
|
+
|
|
172
|
+
Create a `.env` file or set environment variables:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# ClickZetta connection settings
|
|
176
|
+
export CLICKZETTA_SERVICE="your-service.clickzetta.com"
|
|
177
|
+
export CLICKZETTA_USERNAME="your-username"
|
|
178
|
+
export CLICKZETTA_PASSWORD="your-password"
|
|
179
|
+
export CLICKZETTA_INSTANCE="your-instance-id"
|
|
180
|
+
export CLICKZETTA_WORKSPACE="your-workspace"
|
|
181
|
+
export CLICKZETTA_SCHEMA="your-schema"
|
|
182
|
+
export CLICKZETTA_VCLUSTER="default_ap"
|
|
183
|
+
|
|
184
|
+
# LLM API keys (optional for testing)
|
|
185
|
+
export DASHSCOPE_API_KEY="your-dashscope-key"
|
|
186
|
+
export DEEPSEEK_API_KEY="your-deepseek-key"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Step 4: Create ClickZetta Configuration
|
|
190
|
+
|
|
191
|
+
In your Datus agent directory, create a ClickZetta configuration file using the provided example:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# In datus-agent directory
|
|
195
|
+
cp ../datus-db-adapters/datus-clickzetta/examples/agent.clickzetta.yml.example conf/agent.clickzetta.yml
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Update `conf/agent.clickzetta.yml` with ClickZetta settings:
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
agent:
|
|
202
|
+
target: qwen_main # or your preferred model
|
|
203
|
+
home: .datus_home
|
|
204
|
+
|
|
205
|
+
models:
|
|
206
|
+
# Your model configurations here
|
|
207
|
+
|
|
208
|
+
namespace:
|
|
209
|
+
clickzetta:
|
|
210
|
+
type: clickzetta
|
|
211
|
+
service: ${CLICKZETTA_SERVICE}
|
|
212
|
+
username: ${CLICKZETTA_USERNAME}
|
|
213
|
+
password: ${CLICKZETTA_PASSWORD}
|
|
214
|
+
instance: ${CLICKZETTA_INSTANCE}
|
|
215
|
+
workspace: ${CLICKZETTA_WORKSPACE}
|
|
216
|
+
schema: ${CLICKZETTA_SCHEMA}
|
|
217
|
+
vcluster: ${CLICKZETTA_VCLUSTER}
|
|
218
|
+
secure: false
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Step 5: Start Development and Testing
|
|
222
|
+
|
|
223
|
+
**Test the adapter directly:**
|
|
224
|
+
```bash
|
|
225
|
+
# From datus-clickzetta directory
|
|
226
|
+
python -c "
|
|
227
|
+
from datus_clickzetta.connector import ClickZettaConnector
|
|
228
|
+
import os
|
|
229
|
+
|
|
230
|
+
connector = ClickZettaConnector(
|
|
231
|
+
service=os.getenv('CLICKZETTA_SERVICE'),
|
|
232
|
+
username=os.getenv('CLICKZETTA_USERNAME'),
|
|
233
|
+
password=os.getenv('CLICKZETTA_PASSWORD'),
|
|
234
|
+
instance=os.getenv('CLICKZETTA_INSTANCE'),
|
|
235
|
+
workspace=os.getenv('CLICKZETTA_WORKSPACE'),
|
|
236
|
+
schema=os.getenv('CLICKZETTA_SCHEMA'),
|
|
237
|
+
vcluster=os.getenv('CLICKZETTA_VCLUSTER'),
|
|
238
|
+
secure=False
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
result = connector.execute('SHOW SCHEMAS')
|
|
242
|
+
print(f'Connected! Found {result.row_count} schemas')
|
|
243
|
+
"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Start Datus CLI with ClickZetta:**
|
|
247
|
+
```bash
|
|
248
|
+
# From datus-agent directory
|
|
249
|
+
python -m datus.cli.main --config conf/agent.clickzetta.yml --namespace clickzetta
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### Step 6: Development Workflow
|
|
253
|
+
|
|
254
|
+
**Making Changes:**
|
|
255
|
+
1. Edit code in `datus-clickzetta/datus_clickzetta/connector.py`
|
|
256
|
+
2. Changes are immediately available (editable install)
|
|
257
|
+
3. No need to reinstall the package
|
|
258
|
+
|
|
259
|
+
**Testing Changes:**
|
|
260
|
+
```bash
|
|
261
|
+
# Run adapter tests
|
|
262
|
+
cd datus-clickzetta
|
|
263
|
+
python test.py
|
|
264
|
+
|
|
265
|
+
# Test with Datus CLI
|
|
266
|
+
cd ../datus-agent
|
|
267
|
+
python -m datus.cli.main --config conf/agent.clickzetta.yml --namespace clickzetta
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Commit and Push:**
|
|
271
|
+
```bash
|
|
272
|
+
# From adapter directory
|
|
273
|
+
git add .
|
|
274
|
+
git commit -m "Your changes"
|
|
275
|
+
git push origin your-branch
|
|
276
|
+
|
|
277
|
+
# From agent directory (if you made agent changes)
|
|
278
|
+
git add .
|
|
279
|
+
git commit -m "Your agent changes"
|
|
280
|
+
git push origin your-branch
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### Directory Structure
|
|
284
|
+
|
|
285
|
+
```text
|
|
286
|
+
your-dev-folder/
|
|
287
|
+
├── datus-agent/ # Datus agent repository
|
|
288
|
+
│ ├── .venv/ # Shared virtual environment
|
|
289
|
+
│ ├── conf/agent.clickzetta.yml # ClickZetta configuration
|
|
290
|
+
│ └── ...
|
|
291
|
+
└── datus-db-adapters/ # Adapters repository
|
|
292
|
+
└── datus-clickzetta/ # ClickZetta adapter
|
|
293
|
+
├── datus_clickzetta/
|
|
294
|
+
│ └── connector.py # Main connector code
|
|
295
|
+
└── ...
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### Tips for Development
|
|
299
|
+
|
|
300
|
+
- **Editable Installs**: Both packages are installed in editable mode, so code changes are immediate
|
|
301
|
+
- **Environment Variables**: Use `.env` files for local development, environment variables for production
|
|
302
|
+
- **Testing**: Always test both the adapter directly and through the Datus CLI
|
|
303
|
+
- **Debugging**: Use `logger.debug()` statements; enable with `DATUS_LOG_LEVEL=DEBUG`
|
|
304
|
+
|
|
305
|
+
#### Contributing Guidelines
|
|
306
|
+
|
|
307
|
+
1. Clone the repository
|
|
308
|
+
2. Create a feature branch
|
|
309
|
+
3. Make your changes
|
|
310
|
+
4. Run tests: `python test.py`
|
|
311
|
+
5. Ensure code style compliance
|
|
312
|
+
6. Submit a pull request
|
|
313
|
+
|
|
314
|
+
#### Common Development Issues
|
|
315
|
+
|
|
316
|
+
**Import Errors:**
|
|
317
|
+
- Ensure both packages are installed in editable mode
|
|
318
|
+
- Check virtual environment is activated
|
|
319
|
+
|
|
320
|
+
**Connection Issues:**
|
|
321
|
+
- Verify environment variables are set
|
|
322
|
+
- Test connection with the direct connector test above
|
|
323
|
+
|
|
324
|
+
**CLI Issues:**
|
|
325
|
+
- Check configuration file syntax
|
|
326
|
+
- Verify namespace configuration matches your environment
|
|
327
|
+
|
|
328
|
+
## Testing
|
|
329
|
+
|
|
330
|
+
This adapter includes comprehensive test coverage with multiple test types and execution modes.
|
|
331
|
+
|
|
332
|
+
### Test Structure
|
|
333
|
+
|
|
334
|
+
```text
|
|
335
|
+
tests/
|
|
336
|
+
├── unit/ # Unit tests for individual components
|
|
337
|
+
├── integration/ # Integration tests with mocked dependencies
|
|
338
|
+
├── run_tests.py # Main test runner with multiple modes
|
|
339
|
+
├── comprehensive_test.py # Real connection testing script
|
|
340
|
+
└── conftest.py # Shared test fixtures and configuration
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Running Tests
|
|
344
|
+
|
|
345
|
+
**Quick Start (from project root):**
|
|
346
|
+
```bash
|
|
347
|
+
# Run all tests
|
|
348
|
+
python test.py
|
|
349
|
+
|
|
350
|
+
# Run specific test types
|
|
351
|
+
python test.py --mode unit # Unit tests only (fastest)
|
|
352
|
+
python test.py --mode integration # Integration tests only
|
|
353
|
+
python test.py --mode all # All tests
|
|
354
|
+
python test.py --mode coverage # Tests with coverage report
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Advanced Usage (from tests/ directory):**
|
|
358
|
+
```bash
|
|
359
|
+
cd tests
|
|
360
|
+
|
|
361
|
+
# Basic test execution
|
|
362
|
+
python run_tests.py --mode unit
|
|
363
|
+
python run_tests.py --mode integration -v
|
|
364
|
+
|
|
365
|
+
# Real connection testing (requires credentials)
|
|
366
|
+
python comprehensive_test.py
|
|
367
|
+
|
|
368
|
+
# Direct pytest usage
|
|
369
|
+
pytest unit/ # Unit tests
|
|
370
|
+
pytest integration/ # Integration tests
|
|
371
|
+
pytest -k "test_config" # Specific test patterns
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Test Requirements
|
|
375
|
+
|
|
376
|
+
- **Unit Tests**: No external dependencies, run with mocked components
|
|
377
|
+
- **Integration Tests**: Mocked ClickZetta SDK, test connector logic
|
|
378
|
+
- **Real Connection Tests**: Require actual ClickZetta credentials
|
|
379
|
+
|
|
380
|
+
Set environment variables for real connection testing:
|
|
381
|
+
```bash
|
|
382
|
+
export CLICKZETTA_SERVICE="your-service.clickzetta.com"
|
|
383
|
+
export CLICKZETTA_USERNAME="your-username"
|
|
384
|
+
export CLICKZETTA_PASSWORD="your-password"
|
|
385
|
+
export CLICKZETTA_INSTANCE="your-instance"
|
|
386
|
+
export CLICKZETTA_WORKSPACE="your-workspace"
|
|
387
|
+
export CLICKZETTA_SCHEMA="your-schema"
|
|
388
|
+
export CLICKZETTA_VCLUSTER="your-vcluster"
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Test Coverage
|
|
392
|
+
|
|
393
|
+
- ✅ Configuration validation and error handling
|
|
394
|
+
- ✅ SQL query execution and result processing
|
|
395
|
+
- ✅ Metadata discovery (tables, views, schemas)
|
|
396
|
+
- ✅ Connection management and lifecycle
|
|
397
|
+
- ✅ Volume operations and file listing
|
|
398
|
+
- ✅ Error handling and exception cases
|
|
399
|
+
|
|
400
|
+
## License
|
|
401
|
+
|
|
402
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE](../LICENSE) file for details.
|
|
403
|
+
|
|
404
|
+
## Support
|
|
405
|
+
|
|
406
|
+
For issues and questions:
|
|
407
|
+
- [GitHub Issues](https://github.com/Datus-ai/datus-db-adapters/issues)
|
|
408
|
+
- [Datus Documentation](https://docs.datus.ai/)
|
|
409
|
+
- [ClickZetta Documentation](https://www.yunqi.tech/documents)
|