confluent-sql 0.1.0__tar.gz → 0.1.2__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.
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/PKG-INFO +208 -2
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/README.md +5 -5
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/pyproject.toml +21 -2
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/uv.lock +1 -1
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/.github/CODEOWNERS +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/.gitignore +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/.semaphore/publish_to_codeartifact.yml +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/.semaphore/publish_to_pypi.yml +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/.semaphore/semaphore.yml +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/ARCHITECTURE.md +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/DBAPI_EXTENSIONS.md +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/LICENSE.txt +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/Makefile +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/STREAMING.md +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/TYPES.md +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/examples/errors.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/examples/simple_append_only_streaming_query_example.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/examples/snapshot_mode_tuple_cursor_simple_example.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/service.yml +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/__init__.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/__version__.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/changelog_compressor.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/connection.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/cursor.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/exceptions.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/execution_mode.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/result_readers.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/statement.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/src/confluent_sql/types.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/__init__.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/conftest.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/integration/conftest.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/integration/test_connection.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/integration/test_cursor.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/integration/test_fetch.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/conftest.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_changelog_compressor_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_changelog_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_connection_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_cursor_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_execution_mode_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_result_readers_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_statement_unit.py +0 -0
- {confluent_sql-0.1.0 → confluent_sql-0.1.2}/tests/unit/test_types_unit.py +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: confluent-sql
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: DB-API v2 compliant driver for Confluent SQL
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: DB-API v2 compliant driver for Confluent Cloud Flink SQL
|
|
5
|
+
Project-URL: Repository, https://github.com/confluentinc/confluent-sql
|
|
6
|
+
Project-URL: Documentation, https://github.com/confluentinc/confluent-sql?tab=readme-ov-file#confluent-sql
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/confluentinc/confluent-sql/issues
|
|
5
8
|
Maintainer-email: Confluent <support@confluent.io>
|
|
6
9
|
License: Copyright (c) 2026 Confluent Inc.
|
|
7
10
|
|
|
@@ -207,8 +210,211 @@ License: Copyright (c) 2026 Confluent Inc.
|
|
|
207
210
|
See the License for the specific language governing permissions and
|
|
208
211
|
limitations under the License.
|
|
209
212
|
License-File: LICENSE.txt
|
|
213
|
+
Classifier: Development Status :: 4 - Beta
|
|
214
|
+
Classifier: Intended Audience :: Developers
|
|
215
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
216
|
+
Classifier: Operating System :: OS Independent
|
|
217
|
+
Classifier: Programming Language :: Python :: 3
|
|
218
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
219
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
220
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
221
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
222
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
223
|
+
Classifier: Topic :: Database
|
|
210
224
|
Requires-Python: >=3.10
|
|
211
225
|
Requires-Dist: httpx<0.29.0,>=0.23.0
|
|
212
226
|
Provides-Extra: dev
|
|
213
227
|
Requires-Dist: pytest; extra == 'dev'
|
|
214
228
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
229
|
+
Description-Content-Type: text/markdown
|
|
230
|
+
|
|
231
|
+
# confluent-sql
|
|
232
|
+
|
|
233
|
+
A DB-API v2 compliant Python driver for Confluent Cloud Flink SQL services.
|
|
234
|
+
|
|
235
|
+
## Overview
|
|
236
|
+
|
|
237
|
+
The `confluent-sql` library provides a standard DB-API v2 interface for connecting to and
|
|
238
|
+
executing SQL queries against Confluent Cloud Flink SQL services. This allows you to use
|
|
239
|
+
familiar database programming patterns with Confluent's streaming SQL capabilities.
|
|
240
|
+
|
|
241
|
+
## Status
|
|
242
|
+
|
|
243
|
+
This is pre-production code mainly developed as the lower level portion of a `dbt` adaptor for Confluent Cloud Flink, but is aimed to also be a reasonable standalone dbapi+ driver for python programs to interact with Confluent Flink SQL.
|
|
244
|
+
|
|
245
|
+
The behavior of snapshot-mode cursors, complying with dbapi semantics, are well stable. The streaming query extensions are more of a work in progress at this time. Feedback and suggestions are welcome!
|
|
246
|
+
|
|
247
|
+
> **⚠️ Early Access:** [Snapshot queries](https://docs.confluent.io/cloud/current/flink/concepts/snapshot-queries.html) on Confluent Cloud Flink SQL are currently in Early Access and may be subject to change. The driver defaults to snapshot mode for all queries unless streaming mode is explicitly requested.
|
|
248
|
+
|
|
249
|
+
## Prerequisites
|
|
250
|
+
|
|
251
|
+
- **Confluent Cloud account** with Flink environment
|
|
252
|
+
- **Active Flink compute pool** (must be pre-created)
|
|
253
|
+
- **Flink Compute Pool API credentials** for Flink SQL API access: a user or service account API key and secret for the compute pool (used as HTTP Basic Auth, for example via `flink_api_key` and `flink_api_secret`).
|
|
254
|
+
|
|
255
|
+
## Installation
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Using pip
|
|
259
|
+
pip install confluent-sql
|
|
260
|
+
|
|
261
|
+
# Using uv (recommended)
|
|
262
|
+
uv add confluent-sql
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Quick Start
|
|
266
|
+
|
|
267
|
+
Setup the connection:
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
import confluent_sql
|
|
271
|
+
|
|
272
|
+
# Connect to Confluent Cloud Flink SQL
|
|
273
|
+
connection = confluent_sql.connect(
|
|
274
|
+
flink_api_key="your-flink-api-key",
|
|
275
|
+
flink_api_secret="your-flink-api-secret",
|
|
276
|
+
organization_id="your-org-uuid",
|
|
277
|
+
environment="env-123456",
|
|
278
|
+
compute_pool_id="lfcp-789012",
|
|
279
|
+
cloud_provider="aws",
|
|
280
|
+
cloud_region="us-east-2",
|
|
281
|
+
dbname="your-database-name"
|
|
282
|
+
)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Create a cursor and run a point-in-time `SNAPSHOT` query:
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
cursor = connection.cursor()
|
|
289
|
+
cursor.execute("SELECT customer_id, name FROM customers")
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Fetch results using `fetchone()`, `fetchmany()` and `fetchall()`:
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
print(cursor.fetchone())
|
|
296
|
+
print(cursor.fetchmany(2))
|
|
297
|
+
print(cursor.fetchall())
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Fetch results using the cursor as an iterator:
|
|
301
|
+
|
|
302
|
+
```python
|
|
303
|
+
for row in cursor:
|
|
304
|
+
print(row)
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Clean up:
|
|
308
|
+
|
|
309
|
+
```python
|
|
310
|
+
cursor.close()
|
|
311
|
+
connection.close()
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Dictionary Result Rows:**
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
|
|
318
|
+
...
|
|
319
|
+
cursor = connection.cursor(as_dict=True)
|
|
320
|
+
cursor.execute("SELECT customer_id, name, email FROM customers WHERE customer_id = %s", (123,))
|
|
321
|
+
row = cursor.fetchone()
|
|
322
|
+
print(row["customer_id"]) # Access by column name
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Streaming Queries:**
|
|
326
|
+
|
|
327
|
+
```python
|
|
328
|
+
import time
|
|
329
|
+
|
|
330
|
+
...
|
|
331
|
+
|
|
332
|
+
# Execute a streaming statement, runs and produces results indefinitely until
|
|
333
|
+
# we stop consuming its results or the statement is stopped or deleted via API ...
|
|
334
|
+
cursor = connection.streaming_cursor()
|
|
335
|
+
cursor.execute("SELECT * FROM orders_stream WHERE total > %s", (1000,))
|
|
336
|
+
|
|
337
|
+
while cursor.may_have_results:
|
|
338
|
+
rows = cursor.fetchmany(10)
|
|
339
|
+
if rows:
|
|
340
|
+
for row in rows:
|
|
341
|
+
print(row)
|
|
342
|
+
else:
|
|
343
|
+
time.sleep(0.1)
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Parameterized Statement and Flink to Python Value Support
|
|
347
|
+
|
|
348
|
+
This driver supports all Flink types, some with caveats. Please consult [the type support documentation](https://github.com/confluentinc/confluent-sql/blob/main/TYPES.md) for more details.
|
|
349
|
+
|
|
350
|
+
## DB-API Extensions
|
|
351
|
+
|
|
352
|
+
This driver extends the standard DB-API v2 interface with additional features:
|
|
353
|
+
|
|
354
|
+
- **Dictionary result rows** - Access columns by name instead of position
|
|
355
|
+
- **Streaming cursors** - Non-blocking result consumption from continuous queries
|
|
356
|
+
- **Changelog compression** - Automatic state management for aggregations and joins
|
|
357
|
+
- **Statement lifecycle management** - Named statements, labels, and resource management
|
|
358
|
+
- **Type system** - Full support for all Flink SQL types including streaming-specific types
|
|
359
|
+
- **Performance monitoring** - Built-in fetch metrics and introspection
|
|
360
|
+
|
|
361
|
+
## Architecture & How It Works
|
|
362
|
+
|
|
363
|
+
The `confluent-sql` driver communicates with Confluent Cloud Flink SQL through HTTP-based APIs. Unlike in traditional databases, statements are **first-class entities** on the server with their own lifecycle,
|
|
364
|
+
allowing features like:
|
|
365
|
+
|
|
366
|
+
- **Named statements** - Identify and recover queries across connections
|
|
367
|
+
- **Persistent execution** - Statements survive connection close and can be resumed
|
|
368
|
+
- **Batch management** - Label related statements for group operations
|
|
369
|
+
|
|
370
|
+
For an in-depth explanation of the HTTP architecture and statement lifecycle,
|
|
371
|
+
see **[ARCHITECTURE.md](https://github.com/confluentinc/confluent-sql/blob/main/ARCHITECTURE.md)**.
|
|
372
|
+
|
|
373
|
+
### Complete Documentation
|
|
374
|
+
|
|
375
|
+
For comprehensive documentation of all DB-API extensions, see **[DBAPI_EXTENSIONS.md](https://github.com/confluentinc/confluent-sql/blob/main/DBAPI_EXTENSIONS.md)**.
|
|
376
|
+
|
|
377
|
+
For detailed streaming query guidance, see **[STREAMING.md](https://github.com/confluentinc/confluent-sql/blob/main/STREAMING.md)**.
|
|
378
|
+
|
|
379
|
+
For type support and examples, see **[TYPES.md](https://github.com/confluentinc/confluent-sql/blob/main/TYPES.md)**.
|
|
380
|
+
|
|
381
|
+
## Development
|
|
382
|
+
|
|
383
|
+
### Setup
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
# Clone repository
|
|
387
|
+
git clone <repository-url>
|
|
388
|
+
cd confluent-sql
|
|
389
|
+
|
|
390
|
+
# Install uv if needed
|
|
391
|
+
pip install uv
|
|
392
|
+
|
|
393
|
+
# Install dependencies
|
|
394
|
+
uv sync
|
|
395
|
+
|
|
396
|
+
# Install in development mode
|
|
397
|
+
uv pip install -e .
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Running Tests
|
|
401
|
+
|
|
402
|
+
Set required environment variables for integration tests.
|
|
403
|
+
If any of the variables is not set, integration tests will be skipped.
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
export CONFLUENT_FLINK_API_KEY="your-key"
|
|
407
|
+
export CONFLUENT_FLINK_API_SECRET="your-secret"
|
|
408
|
+
export CONFLUENT_ENV_ID="env-123456"
|
|
409
|
+
export CONFLUENT_ORG_ID="org-123456"
|
|
410
|
+
export CONFLUENT_COMPUTE_POOL_ID="lfcp-789012"
|
|
411
|
+
export CONFLUENT_CLOUD_PROVIDER="aws"
|
|
412
|
+
export CONFLUENT_CLOUD_REGION="us-east-2"
|
|
413
|
+
export CONFLUENT_TEST_DBNAME="test-db"
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Run tests:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
uv run pytest
|
|
420
|
+
```
|
|
@@ -115,7 +115,7 @@ while cursor.may_have_results:
|
|
|
115
115
|
|
|
116
116
|
## Parameterized Statement and Flink to Python Value Support
|
|
117
117
|
|
|
118
|
-
This driver supports all Flink types, some with caveats. Please consult [the type support documentation](TYPES.md) for more details.
|
|
118
|
+
This driver supports all Flink types, some with caveats. Please consult [the type support documentation](https://github.com/confluentinc/confluent-sql/blob/main/TYPES.md) for more details.
|
|
119
119
|
|
|
120
120
|
## DB-API Extensions
|
|
121
121
|
|
|
@@ -138,15 +138,15 @@ allowing features like:
|
|
|
138
138
|
- **Batch management** - Label related statements for group operations
|
|
139
139
|
|
|
140
140
|
For an in-depth explanation of the HTTP architecture and statement lifecycle,
|
|
141
|
-
see **[ARCHITECTURE.md](ARCHITECTURE.md)**.
|
|
141
|
+
see **[ARCHITECTURE.md](https://github.com/confluentinc/confluent-sql/blob/main/ARCHITECTURE.md)**.
|
|
142
142
|
|
|
143
143
|
### Complete Documentation
|
|
144
144
|
|
|
145
|
-
For comprehensive documentation of all DB-API extensions, see **[DBAPI_EXTENSIONS.md](DBAPI_EXTENSIONS.md)**.
|
|
145
|
+
For comprehensive documentation of all DB-API extensions, see **[DBAPI_EXTENSIONS.md](https://github.com/confluentinc/confluent-sql/blob/main/DBAPI_EXTENSIONS.md)**.
|
|
146
146
|
|
|
147
|
-
For detailed streaming query guidance, see **[STREAMING.md](STREAMING.md)**.
|
|
147
|
+
For detailed streaming query guidance, see **[STREAMING.md](https://github.com/confluentinc/confluent-sql/blob/main/STREAMING.md)**.
|
|
148
148
|
|
|
149
|
-
For type support and examples, see **[TYPES.md](TYPES.md)**.
|
|
149
|
+
For type support and examples, see **[TYPES.md](https://github.com/confluentinc/confluent-sql/blob/main/TYPES.md)**.
|
|
150
150
|
|
|
151
151
|
## Development
|
|
152
152
|
|
|
@@ -4,13 +4,32 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "confluent-sql"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "DB-API v2 compliant driver for Confluent SQL"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "DB-API v2 compliant driver for Confluent Cloud Flink SQL"
|
|
9
|
+
readme = "README.md"
|
|
9
10
|
requires-python = ">=3.10"
|
|
10
11
|
dependencies = ["httpx>=0.23.0,<0.29.0"]
|
|
11
12
|
platforms = ["any"]
|
|
12
13
|
maintainers = [{ name = "Confluent", email = "support@confluent.io" }]
|
|
13
14
|
license = { file = "LICENSE.txt" }
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Topic :: Database",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Repository = "https://github.com/confluentinc/confluent-sql"
|
|
31
|
+
Documentation = "https://github.com/confluentinc/confluent-sql?tab=readme-ov-file#confluent-sql"
|
|
32
|
+
"Bug Tracker" = "https://github.com/confluentinc/confluent-sql/issues"
|
|
14
33
|
|
|
15
34
|
[tool.ruff]
|
|
16
35
|
line-length = 100
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{confluent_sql-0.1.0 → confluent_sql-0.1.2}/examples/simple_append_only_streaming_query_example.py
RENAMED
|
File without changes
|
{confluent_sql-0.1.0 → confluent_sql-0.1.2}/examples/snapshot_mode_tuple_cursor_simple_example.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|