py-flink-sql-gateway 0.1.0.dev0__tar.gz → 0.1.1.dev0__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.
- py_flink_sql_gateway-0.1.0.dev0/README.md → py_flink_sql_gateway-0.1.1.dev0/PKG-INFO +43 -6
- py_flink_sql_gateway-0.1.0.dev0/PKG-INFO → py_flink_sql_gateway-0.1.1.dev0/README.md +30 -15
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/pyproject.toml +7 -1
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/_version.py +2 -2
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/tests/test_integration.py +49 -3
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/uv.lock +0 -1
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.github/workflows/ci.yml +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.github/workflows/publish.yml +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.gitignore +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.pre-commit-config.yaml +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.python-version +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/__init__.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/client.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/connection.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/cursor.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/exceptions.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/models.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/py.typed +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/types.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/tests/conftest.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/tests/test_client.py +0 -0
- {py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/tests/test_dbapi.py +0 -0
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-flink-sql-gateway
|
|
3
|
+
Version: 0.1.1.dev0
|
|
4
|
+
Summary: A lightweight Python driver for the Apache Flink SQL Gateway, implementing PEP 249 (DB-API 2.0).
|
|
5
|
+
Author-email: Ilya Soin <ilya.soin@exness.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Requires-Dist: httpx>=0.28.1
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
1
14
|
# py-flink-sql-gateway
|
|
2
15
|
|
|
16
|
+
[](https://github.com/exness/py-flink-sql-gateway/actions/workflows/ci.yml)
|
|
17
|
+
[](https://pypi.org/project/py-flink-sql-gateway/)
|
|
18
|
+
[](https://pypi.org/project/py-flink-sql-gateway/)
|
|
19
|
+
|
|
3
20
|
A lightweight Python driver for the **Apache Flink SQL Gateway**, implementing [PEP 249 (DB-API 2.0)](https://peps.python.org/pep-0249/).
|
|
4
21
|
|
|
5
22
|
## Installation
|
|
@@ -61,6 +78,18 @@ with connect("http://localhost:8083") as conn:
|
|
|
61
78
|
|
|
62
79
|
> **Tip:** `ROW` and `MAP` types arrive as Python `dict`, `ARRAY` arrives as `list`. Binary data is passed through as-is.
|
|
63
80
|
|
|
81
|
+
### Connection options
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
# Pass Flink session properties
|
|
85
|
+
with connect("http://localhost:8083", properties={"pipeline.name": "my-job"}) as conn:
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
# Set a query timeout (default: 300s)
|
|
89
|
+
with conn.cursor(query_timeout=60.0) as cur:
|
|
90
|
+
cur.execute("SELECT ...")
|
|
91
|
+
```
|
|
92
|
+
|
|
64
93
|
### Low-level REST access
|
|
65
94
|
|
|
66
95
|
If you need features beyond DB-API, use the exported client directly:
|
|
@@ -78,7 +107,7 @@ with FlinkSqlGatewayClient("http://localhost:8083") as client:
|
|
|
78
107
|
Python uses `None` for SQL NULLs natively — no wrapper types needed.
|
|
79
108
|
|
|
80
109
|
| Flink Type | Python Type |
|
|
81
|
-
|
|
110
|
+
|---------------------------|:------------------:|
|
|
82
111
|
| TINYINT / SMALLINT / INT | `int` |
|
|
83
112
|
| BIGINT / INTERVAL | `int` |
|
|
84
113
|
| FLOAT / DOUBLE | `float` |
|
|
@@ -93,21 +122,29 @@ Python uses `None` for SQL NULLs natively — no wrapper types needed.
|
|
|
93
122
|
| MAP | `dict` |
|
|
94
123
|
| ARRAY | `list` |
|
|
95
124
|
|
|
125
|
+
Nested complex types (e.g. `MAP<STRING, ROW<..., MAP<STRING, ROW<TIMESTAMP>>>>`) are recursively decoded to the correct Python types.
|
|
126
|
+
|
|
96
127
|
---
|
|
97
128
|
|
|
98
129
|
## Development & tests
|
|
99
130
|
|
|
100
|
-
Requires Python 3.
|
|
131
|
+
Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/).
|
|
101
132
|
|
|
102
133
|
```bash
|
|
103
134
|
# Install dependencies
|
|
104
|
-
uv sync
|
|
135
|
+
uv sync --group dev
|
|
136
|
+
|
|
137
|
+
# Set up pre-commit hooks (runs on every push)
|
|
138
|
+
pre-commit install --hook-type pre-push
|
|
105
139
|
|
|
106
140
|
# Run unit tests (no Docker needed)
|
|
107
141
|
uv run pytest tests/test_client.py tests/test_dbapi.py -v
|
|
108
142
|
|
|
109
|
-
# Run
|
|
110
|
-
uv run pytest tests/ -v
|
|
143
|
+
# Run integration tests (requires Docker)
|
|
144
|
+
uv run pytest tests/test_integration.py -v -s -m integration
|
|
145
|
+
|
|
146
|
+
# Run all pre-commit checks manually
|
|
147
|
+
pre-commit run --all-files
|
|
111
148
|
```
|
|
112
149
|
|
|
113
150
|
Integration tests spin up a Flink cluster (JobManager + TaskManager + SQL Gateway) via [testcontainers-python](https://testcontainers-python.readthedocs.io/).
|
|
@@ -116,4 +153,4 @@ Integration tests spin up a Flink cluster (JobManager + TaskManager + SQL Gatewa
|
|
|
116
153
|
|
|
117
154
|
## License
|
|
118
155
|
|
|
119
|
-
MIT
|
|
156
|
+
MIT
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: py-flink-sql-gateway
|
|
3
|
-
Version: 0.1.0.dev0
|
|
4
|
-
Summary: A Python client for the Apache Flink SQL Gateway REST API
|
|
5
|
-
Author-email: Ilya Soin <ilya.soin@exness.com>
|
|
6
|
-
Requires-Python: >=3.11
|
|
7
|
-
Requires-Dist: httpx>=0.28.1
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
|
|
10
1
|
# py-flink-sql-gateway
|
|
11
2
|
|
|
3
|
+
[](https://github.com/exness/py-flink-sql-gateway/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/py-flink-sql-gateway/)
|
|
5
|
+
[](https://pypi.org/project/py-flink-sql-gateway/)
|
|
6
|
+
|
|
12
7
|
A lightweight Python driver for the **Apache Flink SQL Gateway**, implementing [PEP 249 (DB-API 2.0)](https://peps.python.org/pep-0249/).
|
|
13
8
|
|
|
14
9
|
## Installation
|
|
@@ -70,6 +65,18 @@ with connect("http://localhost:8083") as conn:
|
|
|
70
65
|
|
|
71
66
|
> **Tip:** `ROW` and `MAP` types arrive as Python `dict`, `ARRAY` arrives as `list`. Binary data is passed through as-is.
|
|
72
67
|
|
|
68
|
+
### Connection options
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
# Pass Flink session properties
|
|
72
|
+
with connect("http://localhost:8083", properties={"pipeline.name": "my-job"}) as conn:
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
# Set a query timeout (default: 300s)
|
|
76
|
+
with conn.cursor(query_timeout=60.0) as cur:
|
|
77
|
+
cur.execute("SELECT ...")
|
|
78
|
+
```
|
|
79
|
+
|
|
73
80
|
### Low-level REST access
|
|
74
81
|
|
|
75
82
|
If you need features beyond DB-API, use the exported client directly:
|
|
@@ -87,7 +94,7 @@ with FlinkSqlGatewayClient("http://localhost:8083") as client:
|
|
|
87
94
|
Python uses `None` for SQL NULLs natively — no wrapper types needed.
|
|
88
95
|
|
|
89
96
|
| Flink Type | Python Type |
|
|
90
|
-
|
|
97
|
+
|---------------------------|:------------------:|
|
|
91
98
|
| TINYINT / SMALLINT / INT | `int` |
|
|
92
99
|
| BIGINT / INTERVAL | `int` |
|
|
93
100
|
| FLOAT / DOUBLE | `float` |
|
|
@@ -102,21 +109,29 @@ Python uses `None` for SQL NULLs natively — no wrapper types needed.
|
|
|
102
109
|
| MAP | `dict` |
|
|
103
110
|
| ARRAY | `list` |
|
|
104
111
|
|
|
112
|
+
Nested complex types (e.g. `MAP<STRING, ROW<..., MAP<STRING, ROW<TIMESTAMP>>>>`) are recursively decoded to the correct Python types.
|
|
113
|
+
|
|
105
114
|
---
|
|
106
115
|
|
|
107
116
|
## Development & tests
|
|
108
117
|
|
|
109
|
-
Requires Python 3.
|
|
118
|
+
Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/).
|
|
110
119
|
|
|
111
120
|
```bash
|
|
112
121
|
# Install dependencies
|
|
113
|
-
uv sync
|
|
122
|
+
uv sync --group dev
|
|
123
|
+
|
|
124
|
+
# Set up pre-commit hooks (runs on every push)
|
|
125
|
+
pre-commit install --hook-type pre-push
|
|
114
126
|
|
|
115
127
|
# Run unit tests (no Docker needed)
|
|
116
128
|
uv run pytest tests/test_client.py tests/test_dbapi.py -v
|
|
117
129
|
|
|
118
|
-
# Run
|
|
119
|
-
uv run pytest tests/ -v
|
|
130
|
+
# Run integration tests (requires Docker)
|
|
131
|
+
uv run pytest tests/test_integration.py -v -s -m integration
|
|
132
|
+
|
|
133
|
+
# Run all pre-commit checks manually
|
|
134
|
+
pre-commit run --all-files
|
|
120
135
|
```
|
|
121
136
|
|
|
122
137
|
Integration tests spin up a Flink cluster (JobManager + TaskManager + SQL Gateway) via [testcontainers-python](https://testcontainers-python.readthedocs.io/).
|
|
@@ -125,4 +140,4 @@ Integration tests spin up a Flink cluster (JobManager + TaskManager + SQL Gatewa
|
|
|
125
140
|
|
|
126
141
|
## License
|
|
127
142
|
|
|
128
|
-
MIT
|
|
143
|
+
MIT
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "py-flink-sql-gateway"
|
|
3
3
|
dynamic = ["version"]
|
|
4
|
-
description = "A Python
|
|
4
|
+
description = "A lightweight Python driver for the Apache Flink SQL Gateway, implementing PEP 249 (DB-API 2.0)."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
7
7
|
{ name = "Ilya Soin", email = "ilya.soin@exness.com" }
|
|
8
8
|
]
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"Programming Language :: Python :: 3.11",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Programming Language :: Python :: 3.13",
|
|
15
|
+
]
|
|
10
16
|
dependencies = [
|
|
11
17
|
"httpx>=0.28.1",
|
|
12
18
|
]
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/_version.py
RENAMED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
31
|
+
__version__ = version = '0.1.1.dev0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 1, 'dev0')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/tests/test_integration.py
RENAMED
|
@@ -342,7 +342,12 @@ def test_filesystem_row_complex_type(flink_gateway_url: str):
|
|
|
342
342
|
nested_map MAP<STRING, ROW<
|
|
343
343
|
ts TIMESTAMP(3)
|
|
344
344
|
>>
|
|
345
|
-
>> NOT NULL
|
|
345
|
+
>> NOT NULL,
|
|
346
|
+
price DECIMAL(10, 2) NOT NULL,
|
|
347
|
+
birth_date DATE NOT NULL,
|
|
348
|
+
start_time TIME(0) NOT NULL,
|
|
349
|
+
created_at TIMESTAMP(3) NOT NULL,
|
|
350
|
+
updated_ltz TIMESTAMP_LTZ(3) NOT NULL
|
|
346
351
|
) WITH (
|
|
347
352
|
'connector' = 'filesystem',
|
|
348
353
|
'format' = 'json',
|
|
@@ -375,7 +380,12 @@ def test_filesystem_row_complex_type(flink_gateway_url: str):
|
|
|
375
380
|
ROW(TIMESTAMP '2024-03-15 09:30:00.000')
|
|
376
381
|
]
|
|
377
382
|
)
|
|
378
|
-
]
|
|
383
|
+
],
|
|
384
|
+
CAST(99.95 AS DECIMAL(10, 2)),
|
|
385
|
+
DATE '2024-06-15',
|
|
386
|
+
TIME '14:30:00',
|
|
387
|
+
TIMESTAMP '2024-06-15 14:30:00.123',
|
|
388
|
+
TO_TIMESTAMP_LTZ(1718458200123, 3)
|
|
379
389
|
),
|
|
380
390
|
(2, 'beta',
|
|
381
391
|
ROW(20, 'B'),
|
|
@@ -395,7 +405,12 @@ def test_filesystem_row_complex_type(flink_gateway_url: str):
|
|
|
395
405
|
ROW(TIMESTAMP '2025-07-04 18:45:00.000')
|
|
396
406
|
]
|
|
397
407
|
)
|
|
398
|
-
]
|
|
408
|
+
],
|
|
409
|
+
CAST(199.99 AS DECIMAL(10, 2)),
|
|
410
|
+
DATE '2025-12-25',
|
|
411
|
+
TIME '09:15:30',
|
|
412
|
+
TIMESTAMP '2025-12-25 09:15:30.456',
|
|
413
|
+
TO_TIMESTAMP_LTZ(1735117530456, 3)
|
|
399
414
|
)
|
|
400
415
|
""",
|
|
401
416
|
)
|
|
@@ -467,3 +482,34 @@ def test_filesystem_row_complex_type(flink_gateway_url: str):
|
|
|
467
482
|
assert dm["env2"]["nested_map"]["svc3"]["ts"] == datetime.datetime(
|
|
468
483
|
2025, 7, 4, 18, 45, 0
|
|
469
484
|
)
|
|
485
|
+
|
|
486
|
+
# ── Type conversion assertions ────────────────────────────────
|
|
487
|
+
# Row 1
|
|
488
|
+
r = by_id[1]
|
|
489
|
+
|
|
490
|
+
# DECIMAL → Decimal
|
|
491
|
+
assert r[9] == Decimal("99.95")
|
|
492
|
+
assert isinstance(r[9], Decimal)
|
|
493
|
+
|
|
494
|
+
# DATE → datetime.date
|
|
495
|
+
assert r[10] == datetime.date(2024, 6, 15)
|
|
496
|
+
assert isinstance(r[10], datetime.date)
|
|
497
|
+
|
|
498
|
+
# TIME → datetime.time
|
|
499
|
+
assert r[11] == datetime.time(14, 30, 0)
|
|
500
|
+
assert isinstance(r[11], datetime.time)
|
|
501
|
+
|
|
502
|
+
# TIMESTAMP → datetime.datetime
|
|
503
|
+
assert r[12] == datetime.datetime(2024, 6, 15, 14, 30, 0, 123000)
|
|
504
|
+
assert isinstance(r[12], datetime.datetime)
|
|
505
|
+
|
|
506
|
+
# TIMESTAMP_LTZ → datetime.datetime
|
|
507
|
+
assert isinstance(r[13], datetime.datetime)
|
|
508
|
+
|
|
509
|
+
# Row 2
|
|
510
|
+
r = by_id[2]
|
|
511
|
+
assert r[9] == Decimal("199.99")
|
|
512
|
+
assert r[10] == datetime.date(2025, 12, 25)
|
|
513
|
+
assert r[11] == datetime.time(9, 15, 30)
|
|
514
|
+
assert r[12] == datetime.datetime(2025, 12, 25, 9, 15, 30, 456000)
|
|
515
|
+
assert isinstance(r[13], datetime.datetime)
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.github/workflows/ci.yml
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/.github/workflows/publish.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/__init__.py
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/client.py
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/connection.py
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/cursor.py
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/exceptions.py
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/models.py
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/py.typed
RENAMED
|
File without changes
|
{py_flink_sql_gateway-0.1.0.dev0 → py_flink_sql_gateway-0.1.1.dev0}/src/flink_gateway/types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|