duckdb 1.5.0.dev37__cp314-cp314t-macosx_11_0_arm64.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-314t-darwin.so +0 -0
- duckdb/__init__.py +475 -0
- duckdb/__init__.pyi +713 -0
- duckdb/bytes_io_wrapper.py +66 -0
- duckdb/experimental/__init__.py +2 -0
- duckdb/experimental/spark/LICENSE +260 -0
- duckdb/experimental/spark/__init__.py +7 -0
- duckdb/experimental/spark/_globals.py +77 -0
- duckdb/experimental/spark/_typing.py +48 -0
- duckdb/experimental/spark/conf.py +45 -0
- duckdb/experimental/spark/context.py +164 -0
- duckdb/experimental/spark/errors/__init__.py +72 -0
- duckdb/experimental/spark/errors/error_classes.py +918 -0
- duckdb/experimental/spark/errors/exceptions/__init__.py +16 -0
- duckdb/experimental/spark/errors/exceptions/base.py +217 -0
- duckdb/experimental/spark/errors/utils.py +116 -0
- duckdb/experimental/spark/exception.py +15 -0
- duckdb/experimental/spark/sql/__init__.py +7 -0
- duckdb/experimental/spark/sql/_typing.py +93 -0
- duckdb/experimental/spark/sql/catalog.py +78 -0
- duckdb/experimental/spark/sql/column.py +368 -0
- duckdb/experimental/spark/sql/conf.py +23 -0
- duckdb/experimental/spark/sql/dataframe.py +1437 -0
- duckdb/experimental/spark/sql/functions.py +6221 -0
- duckdb/experimental/spark/sql/group.py +420 -0
- duckdb/experimental/spark/sql/readwriter.py +449 -0
- duckdb/experimental/spark/sql/session.py +292 -0
- duckdb/experimental/spark/sql/streaming.py +37 -0
- duckdb/experimental/spark/sql/type_utils.py +105 -0
- duckdb/experimental/spark/sql/types.py +1275 -0
- duckdb/experimental/spark/sql/udf.py +37 -0
- duckdb/filesystem.py +23 -0
- duckdb/functional/__init__.py +17 -0
- duckdb/functional/__init__.pyi +31 -0
- duckdb/polars_io.py +237 -0
- duckdb/query_graph/__main__.py +363 -0
- duckdb/typing/__init__.py +61 -0
- duckdb/typing/__init__.pyi +36 -0
- duckdb/udf.py +19 -0
- duckdb/value/__init__.py +0 -0
- duckdb/value/__init__.pyi +0 -0
- duckdb/value/constant/__init__.py +268 -0
- duckdb/value/constant/__init__.pyi +115 -0
- duckdb-1.5.0.dev37.dist-info/METADATA +80 -0
- duckdb-1.5.0.dev37.dist-info/RECORD +47 -0
- duckdb-1.5.0.dev37.dist-info/WHEEL +6 -0
- duckdb-1.5.0.dev37.dist-info/licenses/LICENSE +7 -0
|
Binary file
|
duckdb/__init__.py
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
# Modules
|
|
2
|
+
import duckdb.functional as functional
|
|
3
|
+
import duckdb.typing as typing
|
|
4
|
+
from _duckdb import __version__ as duckdb_version
|
|
5
|
+
from importlib.metadata import version
|
|
6
|
+
|
|
7
|
+
# duckdb.__version__ returns the version of the distribution package, i.e. the pypi version
|
|
8
|
+
__version__ = version("duckdb")
|
|
9
|
+
|
|
10
|
+
# version() is a more human friendly formatted version string of both the distribution package and the bundled duckdb
|
|
11
|
+
def version():
|
|
12
|
+
return f"{__version__} (with duckdb {duckdb_version})"
|
|
13
|
+
|
|
14
|
+
_exported_symbols = ['__version__', 'version']
|
|
15
|
+
|
|
16
|
+
_exported_symbols.extend([
|
|
17
|
+
"typing",
|
|
18
|
+
"functional"
|
|
19
|
+
])
|
|
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
|
+
|
|
64
|
+
# Classes
|
|
65
|
+
from _duckdb import (
|
|
66
|
+
DuckDBPyRelation,
|
|
67
|
+
DuckDBPyConnection,
|
|
68
|
+
Statement,
|
|
69
|
+
ExplainType,
|
|
70
|
+
StatementType,
|
|
71
|
+
ExpectedResultType,
|
|
72
|
+
CSVLineTerminator,
|
|
73
|
+
PythonExceptionHandling,
|
|
74
|
+
RenderMode,
|
|
75
|
+
Expression,
|
|
76
|
+
ConstantExpression,
|
|
77
|
+
ColumnExpression,
|
|
78
|
+
DefaultExpression,
|
|
79
|
+
CoalesceOperator,
|
|
80
|
+
LambdaExpression,
|
|
81
|
+
StarExpression,
|
|
82
|
+
FunctionExpression,
|
|
83
|
+
CaseExpression,
|
|
84
|
+
SQLExpression
|
|
85
|
+
)
|
|
86
|
+
_exported_symbols.extend([
|
|
87
|
+
"DuckDBPyRelation",
|
|
88
|
+
"DuckDBPyConnection",
|
|
89
|
+
"ExplainType",
|
|
90
|
+
"PythonExceptionHandling",
|
|
91
|
+
"Expression",
|
|
92
|
+
"ConstantExpression",
|
|
93
|
+
"ColumnExpression",
|
|
94
|
+
"DefaultExpression",
|
|
95
|
+
"CoalesceOperator",
|
|
96
|
+
"LambdaExpression",
|
|
97
|
+
"StarExpression",
|
|
98
|
+
"FunctionExpression",
|
|
99
|
+
"CaseExpression",
|
|
100
|
+
"SQLExpression"
|
|
101
|
+
])
|
|
102
|
+
|
|
103
|
+
# These are overloaded twice, we define them inside of C++ so pybind can deal with it
|
|
104
|
+
_exported_symbols.extend([
|
|
105
|
+
'df',
|
|
106
|
+
'arrow'
|
|
107
|
+
])
|
|
108
|
+
from _duckdb import (
|
|
109
|
+
df,
|
|
110
|
+
arrow
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# NOTE: this section is generated by tools/pythonpkg/scripts/generate_connection_wrapper_methods.py.
|
|
114
|
+
# Do not edit this section manually, your changes will be overwritten!
|
|
115
|
+
|
|
116
|
+
# START OF CONNECTION WRAPPER
|
|
117
|
+
|
|
118
|
+
from _duckdb import (
|
|
119
|
+
cursor,
|
|
120
|
+
register_filesystem,
|
|
121
|
+
unregister_filesystem,
|
|
122
|
+
list_filesystems,
|
|
123
|
+
filesystem_is_registered,
|
|
124
|
+
create_function,
|
|
125
|
+
remove_function,
|
|
126
|
+
sqltype,
|
|
127
|
+
dtype,
|
|
128
|
+
type,
|
|
129
|
+
array_type,
|
|
130
|
+
list_type,
|
|
131
|
+
union_type,
|
|
132
|
+
string_type,
|
|
133
|
+
enum_type,
|
|
134
|
+
decimal_type,
|
|
135
|
+
struct_type,
|
|
136
|
+
row_type,
|
|
137
|
+
map_type,
|
|
138
|
+
duplicate,
|
|
139
|
+
execute,
|
|
140
|
+
executemany,
|
|
141
|
+
close,
|
|
142
|
+
interrupt,
|
|
143
|
+
query_progress,
|
|
144
|
+
fetchone,
|
|
145
|
+
fetchmany,
|
|
146
|
+
fetchall,
|
|
147
|
+
fetchnumpy,
|
|
148
|
+
fetchdf,
|
|
149
|
+
fetch_df,
|
|
150
|
+
df,
|
|
151
|
+
fetch_df_chunk,
|
|
152
|
+
pl,
|
|
153
|
+
fetch_arrow_table,
|
|
154
|
+
arrow,
|
|
155
|
+
fetch_record_batch,
|
|
156
|
+
torch,
|
|
157
|
+
tf,
|
|
158
|
+
begin,
|
|
159
|
+
commit,
|
|
160
|
+
rollback,
|
|
161
|
+
checkpoint,
|
|
162
|
+
append,
|
|
163
|
+
register,
|
|
164
|
+
unregister,
|
|
165
|
+
table,
|
|
166
|
+
view,
|
|
167
|
+
values,
|
|
168
|
+
table_function,
|
|
169
|
+
read_json,
|
|
170
|
+
extract_statements,
|
|
171
|
+
sql,
|
|
172
|
+
query,
|
|
173
|
+
from_query,
|
|
174
|
+
read_csv,
|
|
175
|
+
from_csv_auto,
|
|
176
|
+
from_df,
|
|
177
|
+
from_arrow,
|
|
178
|
+
from_parquet,
|
|
179
|
+
read_parquet,
|
|
180
|
+
from_parquet,
|
|
181
|
+
read_parquet,
|
|
182
|
+
get_table_names,
|
|
183
|
+
install_extension,
|
|
184
|
+
load_extension,
|
|
185
|
+
project,
|
|
186
|
+
distinct,
|
|
187
|
+
write_csv,
|
|
188
|
+
aggregate,
|
|
189
|
+
alias,
|
|
190
|
+
filter,
|
|
191
|
+
limit,
|
|
192
|
+
order,
|
|
193
|
+
query_df,
|
|
194
|
+
description,
|
|
195
|
+
rowcount,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
_exported_symbols.extend([
|
|
199
|
+
'cursor',
|
|
200
|
+
'register_filesystem',
|
|
201
|
+
'unregister_filesystem',
|
|
202
|
+
'list_filesystems',
|
|
203
|
+
'filesystem_is_registered',
|
|
204
|
+
'create_function',
|
|
205
|
+
'remove_function',
|
|
206
|
+
'sqltype',
|
|
207
|
+
'dtype',
|
|
208
|
+
'type',
|
|
209
|
+
'array_type',
|
|
210
|
+
'list_type',
|
|
211
|
+
'union_type',
|
|
212
|
+
'string_type',
|
|
213
|
+
'enum_type',
|
|
214
|
+
'decimal_type',
|
|
215
|
+
'struct_type',
|
|
216
|
+
'row_type',
|
|
217
|
+
'map_type',
|
|
218
|
+
'duplicate',
|
|
219
|
+
'execute',
|
|
220
|
+
'executemany',
|
|
221
|
+
'close',
|
|
222
|
+
'interrupt',
|
|
223
|
+
'query_progress',
|
|
224
|
+
'fetchone',
|
|
225
|
+
'fetchmany',
|
|
226
|
+
'fetchall',
|
|
227
|
+
'fetchnumpy',
|
|
228
|
+
'fetchdf',
|
|
229
|
+
'fetch_df',
|
|
230
|
+
'df',
|
|
231
|
+
'fetch_df_chunk',
|
|
232
|
+
'pl',
|
|
233
|
+
'fetch_arrow_table',
|
|
234
|
+
'arrow',
|
|
235
|
+
'fetch_record_batch',
|
|
236
|
+
'torch',
|
|
237
|
+
'tf',
|
|
238
|
+
'begin',
|
|
239
|
+
'commit',
|
|
240
|
+
'rollback',
|
|
241
|
+
'checkpoint',
|
|
242
|
+
'append',
|
|
243
|
+
'register',
|
|
244
|
+
'unregister',
|
|
245
|
+
'table',
|
|
246
|
+
'view',
|
|
247
|
+
'values',
|
|
248
|
+
'table_function',
|
|
249
|
+
'read_json',
|
|
250
|
+
'extract_statements',
|
|
251
|
+
'sql',
|
|
252
|
+
'query',
|
|
253
|
+
'from_query',
|
|
254
|
+
'read_csv',
|
|
255
|
+
'from_csv_auto',
|
|
256
|
+
'from_df',
|
|
257
|
+
'from_arrow',
|
|
258
|
+
'from_parquet',
|
|
259
|
+
'read_parquet',
|
|
260
|
+
'from_parquet',
|
|
261
|
+
'read_parquet',
|
|
262
|
+
'get_table_names',
|
|
263
|
+
'install_extension',
|
|
264
|
+
'load_extension',
|
|
265
|
+
'project',
|
|
266
|
+
'distinct',
|
|
267
|
+
'write_csv',
|
|
268
|
+
'aggregate',
|
|
269
|
+
'alias',
|
|
270
|
+
'filter',
|
|
271
|
+
'limit',
|
|
272
|
+
'order',
|
|
273
|
+
'query_df',
|
|
274
|
+
'description',
|
|
275
|
+
'rowcount',
|
|
276
|
+
])
|
|
277
|
+
|
|
278
|
+
# END OF CONNECTION WRAPPER
|
|
279
|
+
|
|
280
|
+
# Enums
|
|
281
|
+
from _duckdb import (
|
|
282
|
+
ANALYZE,
|
|
283
|
+
DEFAULT,
|
|
284
|
+
RETURN_NULL,
|
|
285
|
+
STANDARD,
|
|
286
|
+
COLUMNS,
|
|
287
|
+
ROWS
|
|
288
|
+
)
|
|
289
|
+
_exported_symbols.extend([
|
|
290
|
+
"ANALYZE",
|
|
291
|
+
"DEFAULT",
|
|
292
|
+
"RETURN_NULL",
|
|
293
|
+
"STANDARD"
|
|
294
|
+
])
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
# read-only properties
|
|
298
|
+
from _duckdb import (
|
|
299
|
+
__standard_vector_size__,
|
|
300
|
+
__interactive__,
|
|
301
|
+
__jupyter__,
|
|
302
|
+
__formatted_python_version__,
|
|
303
|
+
apilevel,
|
|
304
|
+
comment,
|
|
305
|
+
identifier,
|
|
306
|
+
keyword,
|
|
307
|
+
numeric_const,
|
|
308
|
+
operator,
|
|
309
|
+
paramstyle,
|
|
310
|
+
string_const,
|
|
311
|
+
threadsafety,
|
|
312
|
+
token_type,
|
|
313
|
+
tokenize
|
|
314
|
+
)
|
|
315
|
+
_exported_symbols.extend([
|
|
316
|
+
"__standard_vector_size__",
|
|
317
|
+
"__interactive__",
|
|
318
|
+
"__jupyter__",
|
|
319
|
+
"__formatted_python_version__",
|
|
320
|
+
"apilevel",
|
|
321
|
+
"comment",
|
|
322
|
+
"identifier",
|
|
323
|
+
"keyword",
|
|
324
|
+
"numeric_const",
|
|
325
|
+
"operator",
|
|
326
|
+
"paramstyle",
|
|
327
|
+
"string_const",
|
|
328
|
+
"threadsafety",
|
|
329
|
+
"token_type",
|
|
330
|
+
"tokenize"
|
|
331
|
+
])
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
from _duckdb import (
|
|
335
|
+
connect,
|
|
336
|
+
default_connection,
|
|
337
|
+
set_default_connection,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
_exported_symbols.extend([
|
|
341
|
+
"connect",
|
|
342
|
+
"default_connection",
|
|
343
|
+
"set_default_connection",
|
|
344
|
+
])
|
|
345
|
+
|
|
346
|
+
# Exceptions
|
|
347
|
+
from _duckdb import (
|
|
348
|
+
Error,
|
|
349
|
+
DataError,
|
|
350
|
+
ConversionException,
|
|
351
|
+
OutOfRangeException,
|
|
352
|
+
TypeMismatchException,
|
|
353
|
+
FatalException,
|
|
354
|
+
IntegrityError,
|
|
355
|
+
ConstraintException,
|
|
356
|
+
InternalError,
|
|
357
|
+
InternalException,
|
|
358
|
+
InterruptException,
|
|
359
|
+
NotSupportedError,
|
|
360
|
+
NotImplementedException,
|
|
361
|
+
OperationalError,
|
|
362
|
+
ConnectionException,
|
|
363
|
+
IOException,
|
|
364
|
+
HTTPException,
|
|
365
|
+
OutOfMemoryException,
|
|
366
|
+
SerializationException,
|
|
367
|
+
TransactionException,
|
|
368
|
+
PermissionException,
|
|
369
|
+
ProgrammingError,
|
|
370
|
+
BinderException,
|
|
371
|
+
CatalogException,
|
|
372
|
+
InvalidInputException,
|
|
373
|
+
InvalidTypeException,
|
|
374
|
+
ParserException,
|
|
375
|
+
SyntaxException,
|
|
376
|
+
SequenceException,
|
|
377
|
+
Warning
|
|
378
|
+
)
|
|
379
|
+
_exported_symbols.extend([
|
|
380
|
+
"Error",
|
|
381
|
+
"DataError",
|
|
382
|
+
"ConversionException",
|
|
383
|
+
"OutOfRangeException",
|
|
384
|
+
"TypeMismatchException",
|
|
385
|
+
"FatalException",
|
|
386
|
+
"IntegrityError",
|
|
387
|
+
"ConstraintException",
|
|
388
|
+
"InternalError",
|
|
389
|
+
"InternalException",
|
|
390
|
+
"InterruptException",
|
|
391
|
+
"NotSupportedError",
|
|
392
|
+
"NotImplementedException",
|
|
393
|
+
"OperationalError",
|
|
394
|
+
"ConnectionException",
|
|
395
|
+
"IOException",
|
|
396
|
+
"HTTPException",
|
|
397
|
+
"OutOfMemoryException",
|
|
398
|
+
"SerializationException",
|
|
399
|
+
"TransactionException",
|
|
400
|
+
"PermissionException",
|
|
401
|
+
"ProgrammingError",
|
|
402
|
+
"BinderException",
|
|
403
|
+
"CatalogException",
|
|
404
|
+
"InvalidInputException",
|
|
405
|
+
"InvalidTypeException",
|
|
406
|
+
"ParserException",
|
|
407
|
+
"SyntaxException",
|
|
408
|
+
"SequenceException",
|
|
409
|
+
"Warning"
|
|
410
|
+
])
|
|
411
|
+
|
|
412
|
+
# Value
|
|
413
|
+
from duckdb.value.constant import (
|
|
414
|
+
Value,
|
|
415
|
+
NullValue,
|
|
416
|
+
BooleanValue,
|
|
417
|
+
UnsignedBinaryValue,
|
|
418
|
+
UnsignedShortValue,
|
|
419
|
+
UnsignedIntegerValue,
|
|
420
|
+
UnsignedLongValue,
|
|
421
|
+
BinaryValue,
|
|
422
|
+
ShortValue,
|
|
423
|
+
IntegerValue,
|
|
424
|
+
LongValue,
|
|
425
|
+
HugeIntegerValue,
|
|
426
|
+
FloatValue,
|
|
427
|
+
DoubleValue,
|
|
428
|
+
DecimalValue,
|
|
429
|
+
StringValue,
|
|
430
|
+
UUIDValue,
|
|
431
|
+
BitValue,
|
|
432
|
+
BlobValue,
|
|
433
|
+
DateValue,
|
|
434
|
+
IntervalValue,
|
|
435
|
+
TimestampValue,
|
|
436
|
+
TimestampSecondValue,
|
|
437
|
+
TimestampMilisecondValue,
|
|
438
|
+
TimestampNanosecondValue,
|
|
439
|
+
TimestampTimeZoneValue,
|
|
440
|
+
TimeValue,
|
|
441
|
+
TimeTimeZoneValue,
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
_exported_symbols.extend([
|
|
445
|
+
"Value",
|
|
446
|
+
"NullValue",
|
|
447
|
+
"BooleanValue",
|
|
448
|
+
"UnsignedBinaryValue",
|
|
449
|
+
"UnsignedShortValue",
|
|
450
|
+
"UnsignedIntegerValue",
|
|
451
|
+
"UnsignedLongValue",
|
|
452
|
+
"BinaryValue",
|
|
453
|
+
"ShortValue",
|
|
454
|
+
"IntegerValue",
|
|
455
|
+
"LongValue",
|
|
456
|
+
"HugeIntegerValue",
|
|
457
|
+
"FloatValue",
|
|
458
|
+
"DoubleValue",
|
|
459
|
+
"DecimalValue",
|
|
460
|
+
"StringValue",
|
|
461
|
+
"UUIDValue",
|
|
462
|
+
"BitValue",
|
|
463
|
+
"BlobValue",
|
|
464
|
+
"DateValue",
|
|
465
|
+
"IntervalValue",
|
|
466
|
+
"TimestampValue",
|
|
467
|
+
"TimestampSecondValue",
|
|
468
|
+
"TimestampMilisecondValue",
|
|
469
|
+
"TimestampNanosecondValue",
|
|
470
|
+
"TimestampTimeZoneValue",
|
|
471
|
+
"TimeValue",
|
|
472
|
+
"TimeTimeZoneValue",
|
|
473
|
+
])
|
|
474
|
+
|
|
475
|
+
__all__ = _exported_symbols
|