duckdb 1.4.0.dev193__cp39-cp39-macosx_10_9_universal2.whl → 1.5.0.dev32__cp39-cp39-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.
- _duckdb.cpython-39-darwin.so +0 -0
- duckdb/__init__.py +43 -0
- duckdb/__init__.pyi +2 -1
- duckdb/experimental/spark/sql/dataframe.py +1 -1
- duckdb/polars_io.py +15 -3
- {duckdb-1.4.0.dev193.dist-info → duckdb-1.5.0.dev32.dist-info}/METADATA +4 -4
- {duckdb-1.4.0.dev193.dist-info → duckdb-1.5.0.dev32.dist-info}/RECORD +9 -9
- {duckdb-1.4.0.dev193.dist-info → duckdb-1.5.0.dev32.dist-info}/WHEEL +0 -0
- {duckdb-1.4.0.dev193.dist-info → duckdb-1.5.0.dev32.dist-info}/licenses/LICENSE +0 -0
_duckdb.cpython-39-darwin.so
CHANGED
|
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.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
|
@@ -33,9 +33,9 @@ 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">
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
_duckdb.cpython-39-darwin.so,sha256=
|
|
2
|
-
duckdb
|
|
3
|
-
duckdb
|
|
4
|
-
duckdb-1.4.0.dev193.dist-info/METADATA,sha256=EE1iVIBbntH_eAoVafuJtgM7K6r6AUv04ezfJXYoHdc,14102
|
|
5
|
-
duckdb-1.4.0.dev193.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-39-darwin.so,sha256=2vm4m8rYo_-93EfGAZwemeuHgMPdzv5r3elqYq9tnnI,90921392
|
|
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=
|
|
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=
|
|
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=ccxCfpj_PCgwIT8op1roT6eHlYaVqdYRbIkYucugFAA,144
|
|
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
|
|
File without changes
|
|
File without changes
|