Skip to content

Commit 76a1904

Browse files
feat:
- added all new literals and type aliases in the main init file
1 parent 92c906a commit 76a1904

File tree

1 file changed

+55
-47
lines changed

1 file changed

+55
-47
lines changed

_duckdb-stubs/__init__.pyi

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@ if typing.TYPE_CHECKING:
1313
from builtins import list as lst
1414
from collections.abc import Callable, Iterable, Sequence, Mapping
1515
from ._typing import (
16-
ParquetFieldIdsType,
16+
ParquetFieldsOptions,
1717
IntoExpr,
1818
IntoExprColumn,
1919
PythonLiteral,
2020
IntoValues,
2121
IntoDType,
2222
IntoFields,
23+
StrIntoDType,
2324
JoinType,
25+
JsonCompression,
26+
JsonFormat,
27+
JsonRecordOptions,
28+
CsvEncoding,
29+
CsvCompression,
30+
HiveTypes,
31+
ColumnsTypes,
2432
)
2533
from duckdb import sqltypes, func
2634

@@ -227,7 +235,7 @@ class DuckDBPyConnection:
227235
def cursor(self) -> DuckDBPyConnection: ...
228236
def decimal_type(self, width: typing.SupportsInt, scale: typing.SupportsInt) -> sqltypes.DuckDBPyType: ...
229237
def df(self, *, date_as_object: bool = False) -> pandas.DataFrame: ...
230-
def dtype(self, type_str: str) -> sqltypes.DuckDBPyType: ...
238+
def dtype(self, type_str: StrIntoDType) -> sqltypes.DuckDBPyType: ...
231239
def duplicate(self) -> DuckDBPyConnection: ...
232240
def enum_type(self, name: str, type: sqltypes.DuckDBPyType, values: lst[typing.Any]) -> sqltypes.DuckDBPyType: ...
233241
def execute(self, query: Statement | str, parameters: object = None) -> DuckDBPyConnection: ...
@@ -254,18 +262,18 @@ class DuckDBPyConnection:
254262
self,
255263
path_or_buffer: str | bytes | os.PathLike[str] | os.PathLike[bytes] | typing.IO[bytes],
256264
header: bool | int | None = None,
257-
compression: str | None = None,
265+
compression: CsvCompression | None = None,
258266
sep: str | None = None,
259267
delimiter: str | None = None,
260268
files_to_sniff: int | None = None,
261269
comment: str | None = None,
262270
thousands: str | None = None,
263-
dtype: dict[str, str] | lst[str] | None = None,
271+
dtype: IntoFields | None = None,
264272
na_values: str | lst[str] | None = None,
265273
skiprows: int | None = None,
266274
quotechar: str | None = None,
267275
escapechar: str | None = None,
268-
encoding: str | None = None,
276+
encoding: CsvEncoding | None = None,
269277
parallel: bool | None = None,
270278
date_format: str | None = None,
271279
timestamp_format: str | None = None,
@@ -276,8 +284,8 @@ class DuckDBPyConnection:
276284
null_padding: bool | None = None,
277285
names: lst[str] | None = None,
278286
lineterminator: str | None = None,
279-
columns: dict[str, str] | None = None,
280-
auto_type_candidates: lst[str] | None = None,
287+
columns: ColumnsTypes | None = None,
288+
auto_type_candidates: lst[StrIntoDType] | None = None,
281289
max_line_size: int | None = None,
282290
ignore_errors: bool | None = None,
283291
store_rejects: bool | None = None,
@@ -291,7 +299,7 @@ class DuckDBPyConnection:
291299
filename: bool | str | None = None,
292300
hive_partitioning: bool | None = None,
293301
union_by_name: bool | None = None,
294-
hive_types: dict[str, str] | None = None,
302+
hive_types: HiveTypes | None = None,
295303
hive_types_autocast: bool | None = None,
296304
strict_mode: bool | None = None,
297305
) -> DuckDBPyRelation: ...
@@ -355,18 +363,18 @@ class DuckDBPyConnection:
355363
self,
356364
path_or_buffer: str | bytes | os.PathLike[str] | os.PathLike[bytes] | typing.IO[bytes],
357365
header: bool | int | None = None,
358-
compression: str | None = None,
366+
compression: CsvCompression | None = None,
359367
sep: str | None = None,
360368
delimiter: str | None = None,
361369
files_to_sniff: int | None = None,
362370
comment: str | None = None,
363371
thousands: str | None = None,
364-
dtype: dict[str, str] | lst[str] | None = None,
372+
dtype: IntoFields | None = None,
365373
na_values: str | lst[str] | None = None,
366374
skiprows: int | None = None,
367375
quotechar: str | None = None,
368376
escapechar: str | None = None,
369-
encoding: str | None = None,
377+
encoding: CsvEncoding | None = None,
370378
parallel: bool | None = None,
371379
date_format: str | None = None,
372380
timestamp_format: str | None = None,
@@ -377,8 +385,8 @@ class DuckDBPyConnection:
377385
null_padding: bool | None = None,
378386
names: lst[str] | None = None,
379387
lineterminator: str | None = None,
380-
columns: dict[str, str] | None = None,
381-
auto_type_candidates: lst[str] | None = None,
388+
columns: ColumnsTypes | None = None,
389+
auto_type_candidates: lst[StrIntoDType] | None = None,
382390
max_line_size: int | None = None,
383391
ignore_errors: bool | None = None,
384392
store_rejects: bool | None = None,
@@ -392,22 +400,22 @@ class DuckDBPyConnection:
392400
filename: bool | str | None = None,
393401
hive_partitioning: bool | None = None,
394402
union_by_name: bool | None = None,
395-
hive_types: dict[str, str] | None = None,
403+
hive_types: HiveTypes | None = None,
396404
hive_types_autocast: bool | None = None,
397405
strict_mode: bool | None = None,
398406
) -> DuckDBPyRelation: ...
399407
def read_json(
400408
self,
401409
path_or_buffer: str | bytes | os.PathLike[str],
402410
*,
403-
columns: dict[str, str] | None = None,
411+
columns: ColumnsTypes | None = None,
404412
sample_size: int | None = None,
405413
maximum_depth: int | None = None,
406-
records: str | None = None,
407-
format: str | None = None,
414+
records: JsonRecordOptions | None = None,
415+
format: JsonFormat | None = None,
408416
date_format: str | None = None,
409417
timestamp_format: str | None = None,
410-
compression: str | None = None,
418+
compression: JsonCompression | None = None,
411419
maximum_object_size: int | None = None,
412420
ignore_errors: bool | None = None,
413421
convert_strings_to_integers: bool | None = None,
@@ -417,7 +425,7 @@ class DuckDBPyConnection:
417425
filename: bool | str | None = None,
418426
hive_partitioning: bool | None = None,
419427
union_by_name: bool | None = None,
420-
hive_types: dict[str, str] | None = None,
428+
hive_types: HiveTypes | None = None,
421429
hive_types_autocast: bool | None = None,
422430
) -> DuckDBPyRelation: ...
423431
@typing.overload
@@ -671,8 +679,8 @@ class DuckDBPyRelation:
671679
def rank_dense(self, window_spec: str, projected_columns: str = "") -> DuckDBPyRelation: ...
672680
def row_number(self, window_spec: str, projected_columns: str = "") -> DuckDBPyRelation: ...
673681
def select(self, *args: IntoExpr, groups: str = "") -> DuckDBPyRelation: ...
674-
def select_dtypes(self, types: lst[sqltypes.DuckDBPyType | str]) -> DuckDBPyRelation: ...
675-
def select_types(self, types: lst[sqltypes.DuckDBPyType | str]) -> DuckDBPyRelation: ...
682+
def select_dtypes(self, types: lst[sqltypes.DuckDBPyType | StrIntoDType]) -> DuckDBPyRelation: ...
683+
def select_types(self, types: lst[sqltypes.DuckDBPyType | StrIntoDType]) -> DuckDBPyRelation: ...
676684
def set_alias(self, alias: str) -> DuckDBPyRelation: ...
677685
def show(
678686
self,
@@ -716,8 +724,8 @@ class DuckDBPyRelation:
716724
date_format: str | None = None,
717725
timestamp_format: str | None = None,
718726
quoting: str | int | None = None,
719-
encoding: str | None = None,
720-
compression: str | None = None,
727+
encoding: CsvEncoding | None = None,
728+
compression: CsvCompression | None = None,
721729
overwrite: bool | None = None,
722730
per_thread_output: bool | None = None,
723731
use_tmp_file: bool | None = None,
@@ -730,7 +738,7 @@ class DuckDBPyRelation:
730738
file_name: str,
731739
*,
732740
compression: str | None = None,
733-
field_ids: ParquetFieldIdsType | typing.Literal["auto"] | None = None,
741+
field_ids: ParquetFieldsOptions | None = None,
734742
row_group_size_bytes: int | str | None = None,
735743
row_group_size: int | None = None,
736744
overwrite: bool | None = None,
@@ -773,8 +781,8 @@ class DuckDBPyRelation:
773781
date_format: str | None = None,
774782
timestamp_format: str | None = None,
775783
quoting: str | int | None = None,
776-
encoding: str | None = None,
777-
compression: str | None = None,
784+
encoding: CsvEncoding | None = None,
785+
compression: CsvCompression | None = None,
778786
overwrite: bool | None = None,
779787
per_thread_output: bool | None = None,
780788
use_tmp_file: bool | None = None,
@@ -786,7 +794,7 @@ class DuckDBPyRelation:
786794
file_name: str,
787795
*,
788796
compression: str | None = None,
789-
field_ids: ParquetFieldIdsType | typing.Literal["auto"] | None = None,
797+
field_ids: ParquetFieldsOptions | None = None,
790798
row_group_size_bytes: str | int | None = None,
791799
row_group_size: int | None = None,
792800
overwrite: bool | None = None,
@@ -1076,7 +1084,7 @@ def df(*, date_as_object: bool = False, connection: DuckDBPyConnection | None =
10761084
@typing.overload
10771085
def df(df: pandas.DataFrame, *, connection: DuckDBPyConnection | None = None) -> DuckDBPyRelation: ...
10781086
def distinct(df: pandas.DataFrame, *, connection: DuckDBPyConnection | None = None) -> DuckDBPyRelation: ...
1079-
def dtype(type_str: str, *, connection: DuckDBPyConnection | None = None) -> sqltypes.DuckDBPyType: ...
1087+
def dtype(type_str: StrIntoDType, *, connection: DuckDBPyConnection | None = None) -> sqltypes.DuckDBPyType: ...
10801088
def duplicate(*, connection: DuckDBPyConnection | None = None) -> DuckDBPyConnection: ...
10811089
def enum_type(
10821090
name: str,
@@ -1141,18 +1149,18 @@ def from_arrow(
11411149
def from_csv_auto(
11421150
path_or_buffer: str | bytes | os.PathLike[str] | os.PathLike[bytes] | typing.IO[bytes],
11431151
header: bool | int | None = None,
1144-
compression: str | None = None,
1152+
compression: CsvCompression | None = None,
11451153
sep: str | None = None,
11461154
delimiter: str | None = None,
11471155
files_to_sniff: int | None = None,
11481156
comment: str | None = None,
11491157
thousands: str | None = None,
1150-
dtype: dict[str, str] | lst[str] | None = None,
1158+
dtype: IntoFields | None = None,
11511159
na_values: str | lst[str] | None = None,
11521160
skiprows: int | None = None,
11531161
quotechar: str | None = None,
11541162
escapechar: str | None = None,
1155-
encoding: str | None = None,
1163+
encoding: CsvEncoding | None = None,
11561164
parallel: bool | None = None,
11571165
date_format: str | None = None,
11581166
timestamp_format: str | None = None,
@@ -1163,8 +1171,8 @@ def from_csv_auto(
11631171
null_padding: bool | None = None,
11641172
names: lst[str] | None = None,
11651173
lineterminator: str | None = None,
1166-
columns: dict[str, str] | None = None,
1167-
auto_type_candidates: lst[str] | None = None,
1174+
columns: ColumnsTypes | None = None,
1175+
auto_type_candidates: lst[StrIntoDType] | None = None,
11681176
max_line_size: int | None = None,
11691177
ignore_errors: bool | None = None,
11701178
store_rejects: bool | None = None,
@@ -1178,7 +1186,7 @@ def from_csv_auto(
11781186
filename: bool | str | None = None,
11791187
hive_partitioning: bool | None = None,
11801188
union_by_name: bool | None = None,
1181-
hive_types: dict[str, str] | None = None,
1189+
hive_types: HiveTypes | None = None,
11821190
hive_types_autocast: bool | None = None,
11831191
strict_mode: bool | None = None,
11841192
) -> DuckDBPyRelation: ...
@@ -1288,18 +1296,18 @@ def query_progress(*, connection: DuckDBPyConnection | None = None) -> float: ..
12881296
def read_csv(
12891297
path_or_buffer: str | bytes | os.PathLike[str] | os.PathLike[bytes] | typing.IO[bytes],
12901298
header: bool | int | None = None,
1291-
compression: str | None = None,
1299+
compression: CsvCompression | None = None,
12921300
sep: str | None = None,
12931301
delimiter: str | None = None,
12941302
files_to_sniff: int | None = None,
12951303
comment: str | None = None,
12961304
thousands: str | None = None,
1297-
dtype: dict[str, str] | lst[str] | None = None,
1305+
dtype: IntoFields | None = None,
12981306
na_values: str | lst[str] | None = None,
12991307
skiprows: int | None = None,
13001308
quotechar: str | None = None,
13011309
escapechar: str | None = None,
1302-
encoding: str | None = None,
1310+
encoding: CsvEncoding | None = None,
13031311
parallel: bool | None = None,
13041312
date_format: str | None = None,
13051313
timestamp_format: str | None = None,
@@ -1310,8 +1318,8 @@ def read_csv(
13101318
null_padding: bool | None = None,
13111319
names: lst[str] | None = None,
13121320
lineterminator: str | None = None,
1313-
columns: dict[str, str] | None = None,
1314-
auto_type_candidates: lst[str] | None = None,
1321+
columns: ColumnsTypes | None = None,
1322+
auto_type_candidates: lst[StrIntoDType] | None = None,
13151323
max_line_size: int | None = None,
13161324
ignore_errors: bool | None = None,
13171325
store_rejects: bool | None = None,
@@ -1325,21 +1333,21 @@ def read_csv(
13251333
filename: bool | str | None = None,
13261334
hive_partitioning: bool | None = None,
13271335
union_by_name: bool | None = None,
1328-
hive_types: dict[str, str] | None = None,
1336+
hive_types: HiveTypes | None = None,
13291337
hive_types_autocast: bool | None = None,
13301338
strict_mode: bool | None = None,
13311339
) -> DuckDBPyRelation: ...
13321340
def read_json(
13331341
path_or_buffer: str | bytes | os.PathLike[str],
13341342
*,
1335-
columns: dict[str, str] | None = None,
1343+
columns: ColumnsTypes | None = None,
13361344
sample_size: int | None = None,
13371345
maximum_depth: int | None = None,
1338-
records: str | None = None,
1339-
format: str | None = None,
1346+
records: JsonRecordOptions | None = None,
1347+
format: JsonFormat | None = None,
13401348
date_format: str | None = None,
13411349
timestamp_format: str | None = None,
1342-
compression: str | None = None,
1350+
compression: JsonCompression | None = None,
13431351
maximum_object_size: int | None = None,
13441352
ignore_errors: bool | None = None,
13451353
convert_strings_to_integers: bool | None = None,
@@ -1349,7 +1357,7 @@ def read_json(
13491357
filename: bool | str | None = None,
13501358
hive_partitioning: bool | None = None,
13511359
union_by_name: bool | None = None,
1352-
hive_types: dict[str, str] | None = None,
1360+
hive_types: HiveTypes | None = None,
13531361
hive_types_autocast: bool | None = None,
13541362
) -> DuckDBPyRelation: ...
13551363
@typing.overload
@@ -1428,8 +1436,8 @@ def write_csv(
14281436
date_format: str | None = None,
14291437
timestamp_format: str | None = None,
14301438
quoting: str | int | None = None,
1431-
encoding: str | None = None,
1432-
compression: str | None = None,
1439+
encoding: CsvEncoding | None = None,
1440+
compression: CsvCompression | None = None,
14331441
overwrite: bool | None = None,
14341442
per_thread_output: bool | None = None,
14351443
use_tmp_file: bool | None = None,

0 commit comments

Comments
 (0)