duckdb 1.4.0.dev165__cp311-cp311-macosx_10_9_universal2.whl → 1.5.0.dev32__cp311-cp311-macosx_10_9_universal2.whl

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.

Potentially problematic release.


This version of duckdb might be problematic. Click here for more details.

Binary file
duckdb/__init__.py CHANGED
@@ -18,6 +18,49 @@ _exported_symbols.extend([
18
18
  "functional"
19
19
  ])
20
20
 
21
+ class DBAPITypeObject:
22
+ def __init__(self, types: list[typing.DuckDBPyType]) -> None:
23
+ self.types = types
24
+
25
+ def __eq__(self, other):
26
+ if isinstance(other, typing.DuckDBPyType):
27
+ return other in self.types
28
+ return False
29
+
30
+ def __repr__(self):
31
+ return f"<DBAPITypeObject [{','.join(str(x) for x in self.types)}]>"
32
+
33
+ # Define the standard DBAPI sentinels
34
+ STRING = DBAPITypeObject([typing.VARCHAR])
35
+ NUMBER = DBAPITypeObject([
36
+ typing.TINYINT,
37
+ typing.UTINYINT,
38
+ typing.SMALLINT,
39
+ typing.USMALLINT,
40
+ typing.INTEGER,
41
+ typing.UINTEGER,
42
+ typing.BIGINT,
43
+ typing.UBIGINT,
44
+ typing.HUGEINT,
45
+ typing.UHUGEINT,
46
+ typing.DuckDBPyType("BIGNUM"),
47
+ typing.DuckDBPyType("DECIMAL"),
48
+ typing.FLOAT,
49
+ typing.DOUBLE
50
+ ])
51
+ DATETIME = DBAPITypeObject([
52
+ typing.DATE,
53
+ typing.TIME,
54
+ typing.TIME_TZ,
55
+ typing.TIMESTAMP,
56
+ typing.TIMESTAMP_TZ,
57
+ typing.TIMESTAMP_NS,
58
+ typing.TIMESTAMP_MS,
59
+ typing.TIMESTAMP_S
60
+ ])
61
+ BINARY = DBAPITypeObject([typing.BLOB])
62
+ ROWID = None
63
+
21
64
  # Classes
22
65
  from _duckdb import (
23
66
  DuckDBPyRelation,
duckdb/__init__.pyi CHANGED
@@ -415,7 +415,7 @@ class DuckDBPyRelation:
415
415
  def variance(self, column: str, groups: str = ..., window_spec: str = ..., projected_columns: str = ...) -> DuckDBPyRelation: ...
416
416
  def list(self, column: str, groups: str = ..., window_spec: str = ..., projected_columns: str = ...) -> DuckDBPyRelation: ...
417
417
 
418
- def arrow(self, batch_size: int = ...) -> pyarrow.lib.Table: ...
418
+ def arrow(self, batch_size: int = ...) -> pyarrow.lib.RecordBatchReader: ...
419
419
  def __arrow_c_stream__(self, requested_schema: Optional[object] = None) -> object: ...
420
420
  def create(self, table_name: str) -> None: ...
421
421
  def create_view(self, view_name: str, replace: bool = ...) -> DuckDBPyRelation: ...
@@ -448,6 +448,7 @@ class DuckDBPyRelation:
448
448
  def pl(self, rows_per_batch: int = ..., connection: DuckDBPyConnection = ...) -> polars.DataFrame: ...
449
449
  def query(self, virtual_table_name: str, sql_query: str) -> DuckDBPyRelation: ...
450
450
  def record_batch(self, batch_size: int = ...) -> pyarrow.lib.RecordBatchReader: ...
451
+ def fetch_record_batch(self, rows_per_batch: int = 1000000, *, connection: DuckDBPyConnection = ...) -> pyarrow.lib.RecordBatchReader: ...
451
452
  def select_types(self, types: List[Union[str, DuckDBPyType]]) -> DuckDBPyRelation: ...
452
453
  def select_dtypes(self, types: List[Union[str, DuckDBPyType]]) -> DuckDBPyRelation: ...
453
454
  def set_alias(self, alias: str) -> DuckDBPyRelation: ...
@@ -75,7 +75,7 @@ class DataFrame:
75
75
  age: [[2,5]]
76
76
  name: [["Alice","Bob"]]
77
77
  """
78
- return self.relation.arrow()
78
+ return self.relation.to_arrow_table()
79
79
 
80
80
  def createOrReplaceTempView(self, name: str) -> None:
81
81
  """Creates or replaces a local temporary view with this :class:`DataFrame`.
duckdb/polars_io.py CHANGED
@@ -58,6 +58,18 @@ def _pl_operation_to_sql(op: str) -> str:
58
58
  raise NotImplementedError(op)
59
59
 
60
60
 
61
+ def _escape_sql_identifier(identifier: str) -> str:
62
+ """
63
+ Escape SQL identifiers by doubling any double quotes and wrapping in double quotes.
64
+
65
+ Example:
66
+ >>> _escape_sql_identifier('column"name')
67
+ '"column""name"'
68
+ """
69
+ escaped = identifier.replace('"', '""')
70
+ return f'"{escaped}"'
71
+
72
+
61
73
  def _pl_tree_to_sql(tree: dict) -> str:
62
74
  """
63
75
  Recursively convert a Polars expression tree (as JSON) to a SQL string.
@@ -95,7 +107,8 @@ def _pl_tree_to_sql(tree: dict) -> str:
95
107
  )
96
108
  if node_type == "Column":
97
109
  # A reference to a column name
98
- return subtree
110
+ # Wrap in quotes to handle special characters
111
+ return _escape_sql_identifier(subtree)
99
112
 
100
113
  if node_type in ("Literal", "Dyn"):
101
114
  # Recursively process dynamic or literal values
@@ -196,7 +209,7 @@ def duckdb_source(relation: duckdb.DuckDBPyRelation, schema: pl.schema.Schema) -
196
209
  duck_predicate = None
197
210
  relation_final = relation
198
211
  if with_columns is not None:
199
- cols = ",".join(with_columns)
212
+ cols = ",".join(map(_escape_sql_identifier, with_columns))
200
213
  relation_final = relation_final.project(cols)
201
214
  if n_rows is not None:
202
215
  relation_final = relation_final.limit(n_rows)
@@ -213,7 +226,6 @@ def duckdb_source(relation: duckdb.DuckDBPyRelation, schema: pl.schema.Schema) -
213
226
  while True:
214
227
  try:
215
228
  record_batch = results.read_next_batch()
216
- df = pl.from_arrow(record_batch)
217
229
  if predicate is not None and duck_predicate is None:
218
230
  # We have a predicate, but did not manage to push it down, we fallback here
219
231
  yield pl.from_arrow(record_batch).filter(predicate)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: duckdb
3
- Version: 1.4.0.dev165
3
+ Version: 1.5.0.dev32
4
4
  Summary: DuckDB in-process database
5
5
  Keywords: DuckDB,Database,SQL,OLAP
6
6
  Author: DuckDB Foundation
@@ -25,17 +25,17 @@ Classifier: Programming Language :: Python :: 3.12
25
25
  Classifier: Programming Language :: Python :: 3.13
26
26
  Classifier: Programming Language :: C++
27
27
  Project-URL: Documentation, https://duckdb.org/docs/stable/clients/python/overview
28
- Project-URL: Source, https://github.com/duckdb/duckdb/blob/main/tools/pythonpkg
29
- Project-URL: Issues, https://github.com/duckdb/duckdb/issues
28
+ Project-URL: Source, https://github.com/duckdb/duckdb-python
29
+ Project-URL: Issues, https://github.com/duckdb/duckdb-python/issues
30
30
  Project-URL: Changelog, https://github.com/duckdb/duckdb/releases
31
31
  Requires-Python: >=3.9.0
32
32
  Provides-Extra: all
33
33
  Requires-Dist: ipython; extra == "all"
34
34
  Requires-Dist: fsspec; extra == "all"
35
35
  Requires-Dist: numpy; extra == "all"
36
- Requires-Dist: pandas; extra == "all"
37
- Requires-Dist: pyarrow; extra == "all"
38
- Requires-Dist: adbc_driver_manager; extra == "all"
36
+ Requires-Dist: pandas; python_version < "3.14" and extra == "all"
37
+ Requires-Dist: pyarrow; python_version < "3.14" and extra == "all"
38
+ Requires-Dist: adbc_driver_manager; python_version < "3.14" and extra == "all"
39
39
  Description-Content-Type: text/markdown
40
40
 
41
41
  <div align="center">
@@ -47,8 +47,8 @@ Description-Content-Type: text/markdown
47
47
  </div>
48
48
  <br />
49
49
  <p align="center">
50
- <a href="https://discord.gg/tcvwpjfnZx"><img src="https://shields.io/discord/909674491309850675" alt="discord" /></a>
51
- <a href="https://pypi.org/project/duckdb/"><img src="https://img.shields.io/pypi/v/duckdb.svg" alt="PyPi Latest Release"/></a>
50
+ <a href="https://discord.gg/tcvwpjfnZx"><img src="https://shields.io/discord/909674491309850675" alt="Discord" /></a>
51
+ <a href="https://pypi.org/project/duckdb/"><img src="https://img.shields.io/pypi/v/duckdb.svg" alt="PyPI Latest Release"/></a>
52
52
  </p>
53
53
  <br />
54
54
  <p align="center">
@@ -70,7 +70,7 @@ Description-Content-Type: text/markdown
70
70
 
71
71
  ## Installation
72
72
 
73
- Install the latest release of DuckDB directly from [PyPi](https://pypi.org/project/duckdb/):
73
+ Install the latest release of DuckDB directly from [PyPI](https://pypi.org/project/duckdb/):
74
74
 
75
75
  ```bash
76
76
  pip install duckdb
@@ -209,11 +209,11 @@ uvx gcovr \
209
209
  ### Typechecking and linting
210
210
 
211
211
  - We're not running any mypy typechecking tests at the moment
212
- - We're not running any ruff / linting / formatting at the moment
212
+ - We're not running any Ruff / linting / formatting at the moment
213
213
 
214
214
  ### Cibuildwheel
215
215
 
216
- You can run cibuildwheel locally for linux. E.g. limited to Python 3.9:
216
+ You can run cibuildwheel locally for Linux. E.g. limited to Python 3.9:
217
217
  ```bash
218
218
  CIBW_BUILD='cp39-*' uvx cibuildwheel --platform linux .
219
219
  ```
@@ -226,7 +226,7 @@ CIBW_BUILD='cp39-*' uvx cibuildwheel --platform linux .
226
226
  ### Tooling
227
227
 
228
228
  This codebase is developed with the following tools:
229
- - [Astral UV](https://docs.astral.sh/uv/) - for dependency management across all platforms we provide wheels for,
229
+ - [Astral uv](https://docs.astral.sh/uv/) - for dependency management across all platforms we provide wheels for,
230
230
  and for Python environment management. It will be hard to work on this codebase without having UV installed.
231
231
  - [Scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/index.html) - the build backend for
232
232
  building the extension. On the background, scikit-build-core uses cmake and ninja for compilation.
@@ -1,12 +1,8 @@
1
- _duckdb.cpython-311-darwin.so,sha256=5x7a1xt3f-WLMA-4CBlRHFhzMAGYv47Jgmw_fb0FODE,90034240
2
- duckdb-1.4.0.dev165.dist-info/RECORD,,
3
- duckdb-1.4.0.dev165.dist-info/WHEEL,sha256=YX4sgmMvvSPV2lh8q-pASazy7LME-vpJFyIFYhUQBzM,146
4
- duckdb-1.4.0.dev165.dist-info/METADATA,sha256=o3yWrVdDDRRiFiNZ9R0VSjRvPgFrswOVitxtelCpV4M,14114
5
- duckdb-1.4.0.dev165.dist-info/licenses/LICENSE,sha256=fhf9MSSfqHXLOxxeBcbD6Zt1UJ9qKATKF2wheDTeHcs,1072
6
- duckdb/polars_io.py,sha256=Spxz3pHNYs5w-5Gb_iFhgQAK8uJYqtkXkRbU3bFrwWc,7609
7
- duckdb/__init__.pyi,sha256=qiRbaAwwA7T4v5awIPdHX9EUjg7k_U7Df5N5-5TR9hs,47489
1
+ _duckdb.cpython-311-darwin.so,sha256=38fNJoJILxV4oMxSvnfgHpItypks8lFQiDbZi1ANCDU,90937792
2
+ duckdb/polars_io.py,sha256=aYACypblQSzRRTM15p_MHBsC87bij3OkqZEJMIVYXtw,7984
3
+ duckdb/__init__.pyi,sha256=cor15j4NLa9RUe_TTUniloROcJ368UXRDBJNBV-xHaA,47644
8
4
  duckdb/filesystem.py,sha256=9lhkbYbJ8pa__FeZaXe6xDyHRJP-z4t9W7rMe8Adz34,996
9
- duckdb/__init__.py,sha256=x5u9bfVXCaklfMC00uwOtWijVnCINVvzp3OSkHxpqm0,7713
5
+ duckdb/__init__.py,sha256=h-yC_OlYI04Ijah-YDC6PUZYQzcS7lB8Z1V5_uGcJUA,8765
10
6
  duckdb/bytes_io_wrapper.py,sha256=6tEb7dzuokqSEuQrtBGc546YyOncitfi6gUOO3OLIus,2984
11
7
  duckdb/udf.py,sha256=c4eYs6p9R5UMyQjcHNoLTkshSoKutkVF4xwMlq0fljg,674
12
8
  duckdb/experimental/__init__.py,sha256=dsaou_Axm4W4uMylH4NVC6KtR1JHjR0Zdni0lilAih8,44
@@ -25,7 +21,7 @@ duckdb/experimental/spark/errors/exceptions/base.py,sha256=k0WMP7EoIhtYqbYSufyYL
25
21
  duckdb/experimental/spark/sql/catalog.py,sha256=K8W85ccXlN8LzRZAkh5zpFvErpNiDySgAOL0rAfEAEw,2284
26
22
  duckdb/experimental/spark/sql/functions.py,sha256=5hD64AjJbO5ER0xtEnTlmVoOINLLQ3O0ooVyk_SUcus,173108
27
23
  duckdb/experimental/spark/sql/_typing.py,sha256=5CwczuoxRLcIwnfGT4OWC19n6ctsC8JFKNjY4yQ-pFE,2361
28
- duckdb/experimental/spark/sql/dataframe.py,sha256=IHF0fQWpg_-kqKIKRUFF9EtXVvthaka2yqqMAa9unSc,46389
24
+ duckdb/experimental/spark/sql/dataframe.py,sha256=8PvzieUlTTEyqqLgR8IJFtJH9E8UGH6vL3mlFz-EAQI,46398
29
25
  duckdb/experimental/spark/sql/conf.py,sha256=8yIcAD8S4T1f5L1MnjMf86LXxBABu6lbJJJrd_l15Y8,656
30
26
  duckdb/experimental/spark/sql/session.py,sha256=TWrUyepTAIFWMavYwguPiNHVGpc3RHQXK63MQfhQS1A,8998
31
27
  duckdb/experimental/spark/sql/type_utils.py,sha256=YoUxq5KhwfHb4CCIKaEAIbM3R3Ol5_XErjbRJ30eICA,2954
@@ -45,3 +41,7 @@ duckdb/typing/__init__.pyi,sha256=bOkRuedw-3Cw7KP6I3DVdQQBS_uGdnPsyki8H417hN8,92
45
41
  duckdb/typing/__init__.py,sha256=1uy_ItOCRLLVqzUe_jL1qC3-SGf_bb-HvwW1QOrKSXA,854
46
42
  duckdb/functional/__init__.pyi,sha256=HsIdFEv3h32XH06Jg2ppRjg038uWzjWapyJ51A_LoI4,774
47
43
  duckdb/functional/__init__.py,sha256=Ntz7FBorwQ18ldEo-KJpSWIP33S8WGNZlsyva0zG7tQ,212
44
+ duckdb-1.5.0.dev32.dist-info/RECORD,,
45
+ duckdb-1.5.0.dev32.dist-info/WHEEL,sha256=YX4sgmMvvSPV2lh8q-pASazy7LME-vpJFyIFYhUQBzM,146
46
+ duckdb-1.5.0.dev32.dist-info/METADATA,sha256=h9fDfFkEprPBwtXrSmgIuJ6rGhXZ53A7emTUYakVyE0,14185
47
+ duckdb-1.5.0.dev32.dist-info/licenses/LICENSE,sha256=fhf9MSSfqHXLOxxeBcbD6Zt1UJ9qKATKF2wheDTeHcs,1072