ob-postgres 2.36.0__tar.gz → 3.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.
@@ -10,6 +10,11 @@ build/
10
10
  .venv/
11
11
  venv/
12
12
  .env
13
+ # The Compose setup's own settings, credentials, models and data (deploy/compose/README.md).
14
+ deploy/compose/obsl.env
15
+ deploy/compose/secrets/
16
+ deploy/compose/models/
17
+ deploy/compose/data/
13
18
  *.db
14
19
  *.duckdb
15
20
  # Generated FOCUS export (20 MB); rebuilt by scripts/build_finops_duckdb.py.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ob-postgres
3
- Version: 2.36.0
3
+ Version: 3.1.0
4
4
  Summary: OrionBelt Semantic Layer driver for PostgreSQL (DB-API 2.0)
5
5
  Author-email: Ralf Becher <info@orionbelt.ai>
6
6
  License-Expression: BUSL-1.1
@@ -8,7 +8,7 @@ License-File: LICENSE
8
8
  Keywords: db-api,obml,orionbelt,postgres,semantic-layer
9
9
  Requires-Python: >=3.12
10
10
  Requires-Dist: adbc-driver-postgresql>=1.0
11
- Requires-Dist: ob-driver-core>=2.36.0
11
+ Requires-Dist: ob-driver-core>=3.0.0
12
12
  Requires-Dist: pyarrow>=16.0
13
13
  Provides-Extra: dev
14
14
  Requires-Dist: mypy>=1.10; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ob-postgres"
7
- version = "2.36.0"
7
+ version = "3.1.0"
8
8
  description = "OrionBelt Semantic Layer driver for PostgreSQL (DB-API 2.0)"
9
9
  license = "BUSL-1.1"
10
10
  license-files = ["LICENSE"]
@@ -13,7 +13,7 @@ authors = [{ name = "Ralf Becher", email = "info@orionbelt.ai" }]
13
13
  keywords = ["postgres", "semantic-layer", "obml", "db-api", "orionbelt"]
14
14
  requires-python = ">=3.12"
15
15
  dependencies = [
16
- "ob-driver-core>=2.36.0",
16
+ "ob-driver-core>=3.0.0",
17
17
  "adbc-driver-postgresql>=1.0",
18
18
  "pyarrow>=16.0",
19
19
  ]
@@ -138,6 +138,15 @@ class Cursor:
138
138
  self._check_open()
139
139
  return self._native.fetch_arrow_table()
140
140
 
141
+ def fetch_record_batch(self) -> Any:
142
+ """Stream the remaining rows as a ``pyarrow.RecordBatchReader`` (ADBC native).
143
+
144
+ The rows arrive batch by batch rather than as one table, so a caller
145
+ can write a large result to disk without holding all of it in memory.
146
+ """
147
+ self._check_open()
148
+ return self._native.fetch_record_batch()
149
+
141
150
  def close(self) -> None:
142
151
  """Close the cursor."""
143
152
  if not self._closed:
@@ -420,3 +420,21 @@ def test_plain_sql_passthrough() -> None:
420
420
  cur.execute("SELECT COUNT(*) FROM orders")
421
421
  mock_post.assert_not_called()
422
422
  mock_native.cursor().execute.assert_called_once_with("SELECT COUNT(*) FROM orders")
423
+
424
+
425
+ def test_cursor_streams_the_native_record_batch_reader() -> None:
426
+ """A large result can be read batch by batch, not only as one table."""
427
+ mock_native = _make_mock_native()
428
+ reader = object()
429
+ mock_native.cursor().fetch_record_batch.return_value = reader
430
+ cur = Connection(mock_native).cursor()
431
+
432
+ assert cur.fetch_record_batch() is reader
433
+
434
+
435
+ def test_streaming_a_closed_cursor_is_refused() -> None:
436
+ cur = Connection(_make_mock_native()).cursor()
437
+ cur.close()
438
+
439
+ with pytest.raises(ProgrammingError):
440
+ cur.fetch_record_batch()
File without changes
File without changes
File without changes
File without changes