Skip to content

Commit dc2a7b8

Browse files
committed
fix: address PR review feedback for Cassandra plugin
1 parent 48be4c7 commit dc2a7b8

8 files changed

Lines changed: 59 additions & 53 deletions

File tree

.github/workflows/build-plugin.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ jobs:
9898
9999
# Build Cassandra dependencies if needed
100100
if [ "$PLUGIN_NAME" = "cassandra" ]; then
101-
./scripts/build-cassandra.sh arm64
102-
./scripts/build-cassandra.sh x86_64
101+
./scripts/build-cassandra.sh both
103102
fi
104103
105104
# Build both architectures

Plugins/CassandraDriverPlugin/CassandraPlugin.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private actor CassandraConnectionActor {
5252
username: String?,
5353
password: String?,
5454
keyspace: String?,
55-
sslEnabled: Bool,
55+
sslMode: String,
5656
sslCaCertPath: String?
5757
) throws {
5858
cluster = cass_cluster_new()
@@ -68,16 +68,19 @@ private actor CassandraConnectionActor {
6868
}
6969

7070
// SSL/TLS
71-
if sslEnabled {
71+
if sslMode != "Disabled" {
7272
let ssl = cass_ssl_new()
73-
cass_ssl_set_verify_flags(ssl, Int32(CASS_SSL_VERIFY_PEER_CERT.rawValue))
7473

75-
if let caCertPath = sslCaCertPath, !caCertPath.isEmpty,
76-
let certData = FileManager.default.contents(atPath: caCertPath),
77-
let certString = String(data: certData, encoding: .utf8) {
78-
cass_ssl_add_trusted_cert(ssl, certString)
74+
if sslMode == "Verify CA" || sslMode == "Verify Identity" {
75+
cass_ssl_set_verify_flags(ssl, Int32(CASS_SSL_VERIFY_PEER_CERT.rawValue))
76+
77+
if let caCertPath = sslCaCertPath, !caCertPath.isEmpty,
78+
let certData = FileManager.default.contents(atPath: caCertPath),
79+
let certString = String(data: certData, encoding: .utf8) {
80+
cass_ssl_add_trusted_cert(ssl, certString)
81+
}
7982
} else {
80-
// No verification if no CA cert provided
83+
// "Preferred" / "Required" — encrypt but skip cert verification
8184
cass_ssl_set_verify_flags(ssl, Int32(CASS_SSL_VERIFY_NONE.rawValue))
8285
}
8386

@@ -617,7 +620,6 @@ final class CassandraPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
617620

618621
func connect() async throws {
619622
let sslMode = config.additionalFields["sslMode"] ?? "Disabled"
620-
let sslEnabled = sslMode != "Disabled"
621623
let sslCaCertPath = config.additionalFields["sslCaCertPath"]
622624

623625
let keyspace = config.database.isEmpty ? nil : config.database
@@ -628,7 +630,7 @@ final class CassandraPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
628630
username: config.username.isEmpty ? nil : config.username,
629631
password: config.password.isEmpty ? nil : config.password,
630632
keyspace: keyspace,
631-
sslEnabled: sslEnabled,
633+
sslMode: sslMode,
632634
sslCaCertPath: sslCaCertPath
633635
)
634636

docs/databases/cassandra.mdx

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Connect to Cassandra and ScyllaDB clusters, browse keyspaces, and r
77

88
TablePro supports Apache Cassandra 3.11+ and ScyllaDB 4.0+ via the CQL native protocol. Browse keyspaces, inspect table structures, view materialized views, and run CQL queries from the editor.
99

10-
## Quick Setup
10+
## Quick setup
1111

1212
<Steps>
1313
<Step title="Open Connection Form">
@@ -24,17 +24,17 @@ TablePro supports Apache Cassandra 3.11+ and ScyllaDB 4.0+ via the CQL native pr
2424
</Step>
2525
</Steps>
2626

27-
## Connection Settings
27+
## Connection settings
2828

29-
### Required Fields
29+
### Required fields
3030

3131
| Field | Description | Default |
3232
|-------|-------------|---------|
3333
| **Name** | Connection identifier | - |
3434
| **Host** | Contact point hostname or IP | `localhost` |
3535
| **Port** | CQL native transport port | `9042` |
3636

37-
### Optional Fields
37+
### Optional fields
3838

3939
| Field | Description |
4040
|-------|-------------|
@@ -46,17 +46,17 @@ TablePro supports Apache Cassandra 3.11+ and ScyllaDB 4.0+ via the CQL native pr
4646
Local Cassandra installations typically have authentication disabled. Leave username and password empty for local development.
4747
</Tip>
4848

49-
## Connection URL Format
49+
## Connection URL format
5050

5151
Import connections using a Cassandra or ScyllaDB URL.
5252

5353
See [Connection URL Reference](/databases/connection-urls#cassandra--scylladb) for the full URL format.
5454

55-
## Example Configurations
55+
## Example configurations
5656

57-
### Local Development Server
57+
### Local development server
5858

59-
```
59+
```text
6060
Name: Local Cassandra
6161
Host: localhost
6262
Port: 9042
@@ -65,9 +65,9 @@ Password: (empty)
6565
Keyspace: my_keyspace
6666
```
6767

68-
### Docker Cassandra Container
68+
### Docker Cassandra container
6969

70-
```
70+
```text
7171
Name: Docker Cassandra
7272
Host: localhost
7373
Port: 9042 (or your mapped port)
@@ -78,7 +78,7 @@ Keyspace: (empty)
7878

7979
### DataStax Astra DB (Cloud)
8080

81-
```
81+
```text
8282
Name: Astra DB
8383
Host: <your-cluster-id>-<region>.apps.astra.datastax.com
8484
Port: 29042
@@ -91,9 +91,9 @@ Keyspace: my_keyspace
9191
Astra DB requires a Secure Connect Bundle for TLS. Download the bundle from the Astra dashboard and configure it in the SSL/TLS section.
9292
</Note>
9393

94-
### Remote Server
94+
### Remote server
9595

96-
```
96+
```text
9797
Name: Production Cassandra
9898
Host: cassandra.example.com
9999
Port: 9042
@@ -106,7 +106,7 @@ Keyspace: production
106106
For production Cassandra clusters, consider using [SSH tunneling](/databases/ssh-tunneling) for secure connections.
107107
</Warning>
108108

109-
## SSL/TLS Connections
109+
## SSL/TLS connections
110110

111111
Configure SSL in the **SSL/TLS** section of the connection form.
112112

@@ -122,21 +122,21 @@ For **Verify CA** mode, provide the path to your CA certificate file. You can al
122122
If you'd rather skip SSL certificate setup, [SSH tunneling](/databases/ssh-tunneling) encrypts all traffic through an SSH tunnel instead.
123123
</Note>
124124

125-
## SSH Tunnel Support
125+
## SSH tunnel support
126126

127127
Connect to Cassandra through an SSH tunnel for secure access to remote clusters. See [SSH Tunneling](/databases/ssh-tunneling) for setup instructions.
128128

129129
## Features
130130

131-
### Keyspace Browsing
131+
### Keyspace browsing
132132

133133
After connecting, the sidebar lists all keyspaces. Expand a keyspace to see its tables, materialized views, user-defined types (UDTs), and secondary indexes.
134134

135135
1. Click the connection name in the sidebar
136136
2. Expand a keyspace to see its objects
137137
3. Click a table to view its data
138138

139-
### Table Structure
139+
### Table structure
140140

141141
View the full schema for any table:
142142

@@ -146,11 +146,11 @@ View the full schema for any table:
146146
- **Secondary indexes**: index name, target column, index class
147147
- **Table options**: compaction strategy, compression, TTL defaults, gc_grace_seconds
148148

149-
### Materialized Views
149+
### Materialized views
150150

151151
Browse materialized views alongside tables in the sidebar. View their definition, base table, and column mappings.
152152

153-
### Data Grid
153+
### Data grid
154154

155155
Browse table data with pagination. Cell values display with CQL type-aware formatting:
156156

@@ -161,7 +161,7 @@ Browse table data with pagination. Cell values display with CQL type-aware forma
161161
- **map/set/list/tuple** display as formatted collections
162162
- **blob** values display as hex
163163

164-
### CQL Editor
164+
### CQL editor
165165

166166
Execute CQL statements directly in the editor tab:
167167

@@ -197,19 +197,18 @@ CREATE INDEX ON users (email);
197197
DESCRIBE TABLE users;
198198
```
199199

200-
## CQL-Specific Notes
200+
## CQL-specific notes
201201

202202
Cassandra Query Language (CQL) looks like SQL but has important differences:
203203

204204
### No JOINs
205-
206205
CQL does not support JOIN operations. Design your data model around query patterns, denormalizing data across multiple tables as needed.
207206

208-
### No Subqueries
207+
### No subqueries
209208

210209
CQL does not support subqueries. Break complex queries into multiple sequential statements.
211210

212-
### Partition Key Restrictions
211+
### Partition key restrictions
213212

214213
Every SELECT query must include the full partition key in the WHERE clause, unless you use `ALLOW FILTERING` (which scans the entire cluster and should be avoided in production).
215214

@@ -225,7 +224,7 @@ SELECT * FROM orders WHERE total > 100 ALLOW FILTERING;
225224

226225
The `ALLOW FILTERING` clause forces a full cluster scan. It works for development and small datasets but causes timeouts and performance issues on production clusters. TablePro shows a warning when a query includes `ALLOW FILTERING`.
227226

228-
### Lightweight Transactions
227+
### Lightweight transactions
229228

230229
Cassandra supports conditional writes using `IF` clauses (lightweight transactions / compare-and-set):
231230

@@ -245,7 +244,7 @@ SELECT TTL(value), WRITETIME(value) FROM cache WHERE key = 'k1';
245244

246245
## Troubleshooting
247246

248-
### Connection Refused
247+
### Connection refused
249248

250249
**Symptoms**: "Connection refused" or timeout
251250

@@ -271,7 +270,7 @@ SELECT TTL(value), WRITETIME(value) FROM cache WHERE key = 'k1';
271270
- Check `rpc_address` and `listen_address` in `cassandra.yaml`
272271
- For remote connections, set `rpc_address` to `0.0.0.0`
273272

274-
### Authentication Failed
273+
### Authentication failed
275274

276275
**Symptoms**: "Provided username and/or password are incorrect"
277276

@@ -285,7 +284,7 @@ SELECT TTL(value), WRITETIME(value) FROM cache WHERE key = 'k1';
285284
```
286285
3. Default superuser is `cassandra` / `cassandra` (change this in production)
287286

288-
### Connection Timeout
287+
### Connection timeout
289288

290289
**Symptoms**: Connection hangs or times out
291290

@@ -296,7 +295,7 @@ SELECT TTL(value), WRITETIME(value) FROM cache WHERE key = 'k1';
296295
3. For cloud-hosted Cassandra, ensure your IP is in the allowed list
297296
4. Increase the connection timeout in the Advanced tab
298297

299-
### Read Timeout
298+
### Read timeout
300299

301300
**Symptoms**: "Read timed out" on queries
302301

@@ -307,17 +306,17 @@ SELECT TTL(value), WRITETIME(value) FROM cache WHERE key = 'k1';
307306
3. Check cluster health with `nodetool status`
308307
4. Reduce the result set with `LIMIT`
309308

310-
## Known Limitations
309+
## Known limitations
311310

312311
- **Multi-datacenter**: connecting to a specific datacenter is not yet configurable. TablePro connects to whichever node the contact point resolves to.
313312
- **User-Defined Functions (UDFs)**: UDFs and UDAs are not displayed in the sidebar but can be used in CQL queries.
314313
- **BATCH statements**: supported in the CQL editor but not generated by the change tracking system.
315314
- **Counter tables**: counter columns are read-only in the data grid. Use the CQL editor for counter updates.
316315
- **Large partitions**: partitions with millions of rows are paginated automatically to prevent memory issues.
317316

318-
## Performance Tips
317+
## Performance tips
319318

320-
### Query Performance
319+
### Query performance
321320

322321
For Cassandra clusters with large datasets:
323322

@@ -339,7 +338,7 @@ Check cluster health and performance:
339338
SELECT * FROM system.size_estimates WHERE keyspace_name = 'my_keyspace';
340339
```
341340

342-
## Next Steps
341+
## Next steps
343342

344343
<CardGroup cols={2}>
345344
<Card title="SSH Tunneling" icon="lock" href="/databases/ssh-tunneling">

docs/databases/connection-urls.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ rediss://:password@host:6380 # TLS, default index 0
170170

171171
The path component sets the default keyspace. Both `cassandra://` and `scylladb://` schemes use the same format.
172172

173-
```
173+
```text
174174
cassandra://user:pass@host:9042/my_keyspace
175175
scylladb://user:pass@host:9042/my_keyspace
176176
cassandra://host:9042 # no auth, no default keyspace

docs/vi/databases/cassandra.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Xem [Tham chiếu URL kết nối](/vi/databases/connection-urls#cassandra--scyl
5656

5757
### Server Dev Local
5858

59-
```
59+
```text
6060
Name: Local Cassandra
6161
Host: localhost
6262
Port: 9042
@@ -67,7 +67,7 @@ Keyspace: my_keyspace
6767

6868
### Docker Cassandra Container
6969

70-
```
70+
```text
7171
Name: Docker Cassandra
7272
Host: localhost
7373
Port: 9042 (hoặc cổng mapped)
@@ -78,7 +78,7 @@ Keyspace: (để trống)
7878

7979
### DataStax Astra DB (Cloud)
8080

81-
```
81+
```text
8282
Name: Astra DB
8383
Host: <your-cluster-id>-<region>.apps.astra.datastax.com
8484
Port: 29042
@@ -93,7 +93,7 @@ Astra DB yêu cầu Secure Connect Bundle cho TLS. Tải bundle từ Astra dashb
9393

9494
### Server Từ xa
9595

96-
```
96+
```text
9797
Name: Production Cassandra
9898
Host: cassandra.example.com
9999
Port: 9042

docs/vi/databases/connection-urls.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ rediss://:password@host:6380 # TLS, index mặc định 0
170170

171171
Phần path đặt keyspace mặc định. Cả hai scheme `cassandra://``scylladb://` dùng cùng format.
172172

173-
```
173+
```text
174174
cassandra://user:pass@host:9042/my_keyspace
175175
scylladb://user:pass@host:9042/my_keyspace
176176
cassandra://host:9042 # không auth, không keyspace mặc định

docs/vi/databases/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ open "mysql://root:secret@localhost:3306/myapp"
108108
open "redis://:password@localhost:6379"
109109
```
110110

111-
TablePro đăng ký `postgresql`, `postgres`, `mysql`, `mariadb`, `sqlite`, `mongodb`, `mongodb+srv`, `redis`, `rediss`, `redshift`, `mssql`, `sqlserver`, `oracle`, `clickhouse`, `cassandra``scylladb` là các URL scheme trên macOS, nên hệ điều hành sẽ chuyển hướng các URL này trực tiếp đến ứng dụng.
111+
TablePro đăng ký `postgresql`, `postgres`, `mysql`, `mariadb`, `sqlite`, `mongodb`, `mongodb+srv`, `redis`, `rediss`, `redshift`, `mssql`, `sqlserver`, `oracle`, `clickhouse`, `duckdb`, `cassandra``scylladb` là các URL scheme trên macOS, nên hệ điều hành sẽ chuyển hướng các URL này trực tiếp đến ứng dụng.
112112

113113
**Khi mở URL:**
114114

@@ -131,7 +131,7 @@ Khác với **Import from URL** (điền form để bạn xem xét và lưu), m
131131
| Trường | Mô tả |
132132
|-------|-------------|
133133
| **Name** | Tên thân thiện để xác định kết nối này |
134-
| **Type** | Loại cơ sở dữ liệu: MySQL, MariaDB, PostgreSQL, SQLite, MongoDB, Redis, Redshift, SQL Server, Oracle, ClickHouse, Cassandra hoặc ScyllaDB |
134+
| **Type** | Loại cơ sở dữ liệu: MySQL, MariaDB, PostgreSQL, SQLite, MongoDB, Redis, Redshift, SQL Server, Oracle, ClickHouse, DuckDB, Cassandra hoặc ScyllaDB |
135135

136136
#### Phần Appearance
137137

scripts/build-cassandra.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ build_cassandra() {
108108
# --- Copy headers ---
109109
copy_headers() {
110110
echo "📋 Copying cassandra.h header..."
111+
112+
if [ -f "$HEADERS_DIR/cassandra.h" ]; then
113+
echo "✅ cassandra.h already exists, skipping"
114+
return 0
115+
fi
116+
111117
cd "$BUILD_DIR"
112118

113119
if [ -f "cassandra-cpp-driver-${CASSANDRA_VERSION}/include/cassandra.h" ]; then

0 commit comments

Comments
 (0)