jupyter-duckdb 1.1.3.1__py3-none-any.whl → 1.1.3.4__py3-none-any.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.
- duckdb_kernel/kernel.py +22 -0
- duckdb_kernel/magics/MagicCommandHandler.py +1 -1
- {jupyter_duckdb-1.1.3.1.dist-info → jupyter_duckdb-1.1.3.4.dist-info}/METADATA +14 -4
- {jupyter_duckdb-1.1.3.1.dist-info → jupyter_duckdb-1.1.3.4.dist-info}/RECORD +6 -6
- {jupyter_duckdb-1.1.3.1.dist-info → jupyter_duckdb-1.1.3.4.dist-info}/WHEEL +1 -1
- {jupyter_duckdb-1.1.3.1.dist-info → jupyter_duckdb-1.1.3.4.dist-info}/top_level.txt +0 -0
duckdb_kernel/kernel.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import csv
|
|
1
2
|
import json
|
|
2
3
|
import math
|
|
3
4
|
import os
|
|
@@ -43,6 +44,7 @@ class DuckDBKernel(Kernel):
|
|
|
43
44
|
MagicCommand('max_rows').arg('count').on(self._max_rows_magic),
|
|
44
45
|
MagicCommand('query_max_rows').arg('count').on(self._query_max_rows_magic),
|
|
45
46
|
MagicCommand('schema').flag('td').opt('only').on(self._schema_magic),
|
|
47
|
+
MagicCommand('store').arg('file').flag('noheader').result(True).on(self._store_magic),
|
|
46
48
|
MagicCommand('ra').flag('analyze').code(True).on(self._ra_magic),
|
|
47
49
|
MagicCommand('dc').code(True).on(self._dc_magic)
|
|
48
50
|
)
|
|
@@ -434,6 +436,26 @@ class DuckDBKernel(Kernel):
|
|
|
434
436
|
|
|
435
437
|
self.print_data(svg)
|
|
436
438
|
|
|
439
|
+
def _store_magic(self, silent: bool, result_columns: List[str], result: List[List], file: str, noheader: bool):
|
|
440
|
+
_, ext = file.rsplit('.', 1)
|
|
441
|
+
|
|
442
|
+
# csv
|
|
443
|
+
if ext == 'csv':
|
|
444
|
+
with open(file, 'w', encoding='utf-8') as f:
|
|
445
|
+
writer = csv.writer(f)
|
|
446
|
+
|
|
447
|
+
if not noheader:
|
|
448
|
+
writer.writerow(result_columns)
|
|
449
|
+
|
|
450
|
+
for row in result:
|
|
451
|
+
writer.writerow(row)
|
|
452
|
+
|
|
453
|
+
self.print(f'result stored to {file}', name='stderr')
|
|
454
|
+
|
|
455
|
+
# unsupported
|
|
456
|
+
else:
|
|
457
|
+
raise ValueError(f'extension {ext} not supported')
|
|
458
|
+
|
|
437
459
|
def _ra_magic(self, silent: bool, code: str, analyze: bool):
|
|
438
460
|
if self._db is None:
|
|
439
461
|
raise AssertionError('load a database first')
|
|
@@ -20,7 +20,7 @@ class MagicCommandHandler:
|
|
|
20
20
|
|
|
21
21
|
while True:
|
|
22
22
|
# ensure code starts with '%' or '%%' but not with '%%%'
|
|
23
|
-
match = re.match(r'^%{1,2}([^% ]+?)(
|
|
23
|
+
match = re.match(r'^%{1,2}([^% ]+?)([ \t]*$| .+?$)', code, re.MULTILINE | re.IGNORECASE)
|
|
24
24
|
|
|
25
25
|
if match is None:
|
|
26
26
|
break
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: jupyter-duckdb
|
|
3
|
-
Version: 1.1.3.
|
|
3
|
+
Version: 1.1.3.4
|
|
4
4
|
Summary: a basic wrapper kernel for DuckDB
|
|
5
5
|
Home-page: https://github.com/erictroebs/jupyter-duckdb
|
|
6
6
|
Author: Eric Tröbs
|
|
@@ -12,9 +12,19 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Requires-Python: >=3.10
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
Requires-Dist: jupyter
|
|
15
|
-
Requires-Dist: graphviz
|
|
15
|
+
Requires-Dist: graphviz==0.20.3
|
|
16
16
|
Requires-Dist: checkmarkandcross
|
|
17
|
-
Requires-Dist: duckdb
|
|
17
|
+
Requires-Dist: duckdb==1.1.3
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: project-url
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
18
28
|
|
|
19
29
|
# DuckDB Kernel for Jupyter
|
|
20
30
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
duckdb_kernel/__init__.py,sha256=6auU6zeJrsA4fxPSr2PYamS8fG-SMXTn5YQFXF2cseo,33
|
|
2
2
|
duckdb_kernel/__main__.py,sha256=Z3GwHEBWoQjNm2Y84ijnbA0Lk66L7nsFREuqhZ_ptk0,165
|
|
3
3
|
duckdb_kernel/kernel.json,sha256=_7E8Ci2FSdCvnzCjsOaue8QE8AvpS5JLQuxORO5IGtA,127
|
|
4
|
-
duckdb_kernel/kernel.py,sha256=
|
|
4
|
+
duckdb_kernel/kernel.py,sha256=wEEH7ZH7lbOvCa8NUe_5yuGT0P45Qg37NPzGT1-BMLc,19396
|
|
5
5
|
duckdb_kernel/db/Column.py,sha256=GM5P6sFdlYK92hiKln5-6038gIDOTxh1AYbR4kiga_w,559
|
|
6
6
|
duckdb_kernel/db/Connection.py,sha256=5pH-CwGh-r9Q2QwJKGSxvoINBU-sqmvZyG4Q1digfeE,599
|
|
7
7
|
duckdb_kernel/db/Constraint.py,sha256=1YgUHk7s8mHCVedbcuJKyXDykj7_ybbwT3Dk9p2VMis,287
|
|
@@ -21,7 +21,7 @@ duckdb_kernel/db/implementation/sqlite/__init__.py,sha256=HKogB1es4wOiQUoh7_eT32
|
|
|
21
21
|
duckdb_kernel/magics/MagicCommand.py,sha256=OoQ6j4cNtIYjaK4MPVzJyv1eYTNu4_a7qoRx-5G3Hg0,2346
|
|
22
22
|
duckdb_kernel/magics/MagicCommandCallback.py,sha256=r1kkJyRR7sZnrnlMH3w4bGqDAJL-BVTIB4-Kn66ynlM,764
|
|
23
23
|
duckdb_kernel/magics/MagicCommandException.py,sha256=MwuWkpA6NoCqz437urdI0RVXhbSbVdziuRoi7slYFPc,49
|
|
24
|
-
duckdb_kernel/magics/MagicCommandHandler.py,sha256=
|
|
24
|
+
duckdb_kernel/magics/MagicCommandHandler.py,sha256=4njm49cNnLBH9j8GazrmA-wF8XkXfSioJDuCoDyumqc,2749
|
|
25
25
|
duckdb_kernel/magics/__init__.py,sha256=DA8gnQeRCUt1Scy3_NQ9w5CPmMEY9i8YwB-g392pN1U,204
|
|
26
26
|
duckdb_kernel/parser/DCParser.py,sha256=ciNdM_ZFfa10bBlAc_bB2tKmPOxnXBcAGpYROjbAkVY,2120
|
|
27
27
|
duckdb_kernel/parser/LogicParser.py,sha256=PI4NTe4UZIsnEvoAe_LgpEtmGraTTmYOsUk5_Qr3QOk,1137
|
|
@@ -76,7 +76,7 @@ duckdb_kernel/visualization/Drawer.py,sha256=D0LkiGMvuJ2v6cQSg_axLTGaM4VXAJEQJAy
|
|
|
76
76
|
duckdb_kernel/visualization/RATreeDrawer.py,sha256=j-Vy1zpYMzwZ3CsphyfPW-J7ou9a9tM6aXXgAlQTgDI,2128
|
|
77
77
|
duckdb_kernel/visualization/SchemaDrawer.py,sha256=9K-TUUmyeGdMYMTFQJ7evIU3p8p2KyMKeizUc7-y8co,3015
|
|
78
78
|
duckdb_kernel/visualization/__init__.py,sha256=5eMJmxJ01XAXcgWDn3t70eSZF2PGaXdNo6GK-x-0H3s,78
|
|
79
|
-
jupyter_duckdb-1.1.3.
|
|
80
|
-
jupyter_duckdb-1.1.3.
|
|
81
|
-
jupyter_duckdb-1.1.3.
|
|
82
|
-
jupyter_duckdb-1.1.3.
|
|
79
|
+
jupyter_duckdb-1.1.3.4.dist-info/METADATA,sha256=A9678InK3tin-SiZ5i9k0LFHtzybk9L-DIg-WUQw01E,7980
|
|
80
|
+
jupyter_duckdb-1.1.3.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
81
|
+
jupyter_duckdb-1.1.3.4.dist-info/top_level.txt,sha256=KvRRPMnmkQNuhyBsXoPmwyt26LRDp0O-0HN6u0Dm5jA,14
|
|
82
|
+
jupyter_duckdb-1.1.3.4.dist-info/RECORD,,
|
|
File without changes
|