jupyter-duckdb 1.1.2.2__py3-none-any.whl → 1.1.2.3__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/db/Column.py +2 -1
- duckdb_kernel/db/implementation/duckdb/Connection.py +5 -4
- duckdb_kernel/db/implementation/postgres/Connection.py +4 -3
- duckdb_kernel/db/implementation/sqlite/Connection.py +4 -3
- duckdb_kernel/parser/util/RenamableColumn.py +1 -1
- duckdb_kernel/visualization/SchemaDrawer.py +3 -0
- {jupyter_duckdb-1.1.2.2.dist-info → jupyter_duckdb-1.1.2.3.dist-info}/METADATA +1 -1
- {jupyter_duckdb-1.1.2.2.dist-info → jupyter_duckdb-1.1.2.3.dist-info}/RECORD +10 -10
- {jupyter_duckdb-1.1.2.2.dist-info → jupyter_duckdb-1.1.2.3.dist-info}/WHEEL +1 -1
- {jupyter_duckdb-1.1.2.2.dist-info → jupyter_duckdb-1.1.2.3.dist-info}/top_level.txt +0 -0
duckdb_kernel/db/Column.py
CHANGED
|
@@ -4,10 +4,11 @@ from .Table import Table
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Column:
|
|
7
|
-
def __init__(self, table: Table, name: str, data_type: str):
|
|
7
|
+
def __init__(self, table: Table, name: str, data_type: str, null: bool):
|
|
8
8
|
self.table: Table = table
|
|
9
9
|
self.name: str = name
|
|
10
10
|
self.data_type: str = data_type
|
|
11
|
+
self.null: bool = null
|
|
11
12
|
|
|
12
13
|
def __hash__(self):
|
|
13
14
|
return self.name.__hash__()
|
|
@@ -48,7 +48,7 @@ class Connection(Base):
|
|
|
48
48
|
|
|
49
49
|
def analyze(self) -> Dict[str, Table]:
|
|
50
50
|
tables: Dict[str, Table] = {}
|
|
51
|
-
constraints: Dict[
|
|
51
|
+
constraints: Dict[Tuple, Constraint] = {}
|
|
52
52
|
|
|
53
53
|
# Get table names first. In the columns table we can not filter
|
|
54
54
|
# for base tables and some of the tables might not be contained
|
|
@@ -62,18 +62,19 @@ class Connection(Base):
|
|
|
62
62
|
tables[table_name] = table
|
|
63
63
|
|
|
64
64
|
# Get column names and data types for each table.
|
|
65
|
-
for table_name, column_name, data_type in self.con.execute('''
|
|
65
|
+
for table_name, column_name, data_type, is_nullable in self.con.execute('''
|
|
66
66
|
SELECT
|
|
67
67
|
table_name,
|
|
68
68
|
column_name,
|
|
69
|
-
data_type
|
|
69
|
+
data_type,
|
|
70
|
+
is_nullable
|
|
70
71
|
FROM information_schema.columns
|
|
71
72
|
ORDER BY ordinal_position ASC
|
|
72
73
|
''').fetchall():
|
|
73
74
|
if table_name in tables:
|
|
74
75
|
table = tables[table_name]
|
|
75
76
|
|
|
76
|
-
column = Column(table, column_name, data_type)
|
|
77
|
+
column = Column(table, column_name, data_type, is_nullable == 'YES')
|
|
77
78
|
table.columns.append(column)
|
|
78
79
|
|
|
79
80
|
# Find primary keys.
|
|
@@ -91,18 +91,19 @@ class Connection(Base):
|
|
|
91
91
|
tables[table_name] = table
|
|
92
92
|
|
|
93
93
|
# Get column names and data types for each table.
|
|
94
|
-
for table_name, column_name, data_type in self.con.execute('''
|
|
94
|
+
for table_name, column_name, data_type, is_nullable in self.con.execute('''
|
|
95
95
|
SELECT
|
|
96
96
|
table_name,
|
|
97
97
|
column_name,
|
|
98
|
-
data_type
|
|
98
|
+
data_type,
|
|
99
|
+
is_nullable
|
|
99
100
|
FROM information_schema.columns
|
|
100
101
|
ORDER BY ordinal_position ASC
|
|
101
102
|
''').fetchall():
|
|
102
103
|
if table_name in tables:
|
|
103
104
|
table = tables[table_name]
|
|
104
105
|
|
|
105
|
-
column = Column(table, column_name, data_type)
|
|
106
|
+
column = Column(table, column_name, data_type, is_nullable == 'YES')
|
|
106
107
|
table.columns.append(column)
|
|
107
108
|
|
|
108
109
|
# Find primary keys.
|
|
@@ -8,6 +8,7 @@ from ...Connection import Connection as Base
|
|
|
8
8
|
|
|
9
9
|
class Connection(Base):
|
|
10
10
|
def __init__(self, path: str):
|
|
11
|
+
self.path: str = path
|
|
11
12
|
self.con: sqlite3.Connection = sqlite3.connect(path)
|
|
12
13
|
self.con.execute('PRAGMA foreign_keys = ON')
|
|
13
14
|
|
|
@@ -64,11 +65,11 @@ class Connection(Base):
|
|
|
64
65
|
|
|
65
66
|
# Get column names and data types for each table.
|
|
66
67
|
for table_name, table in tables.items():
|
|
67
|
-
for column_name, data_type in self.con.execute(f'''
|
|
68
|
-
SELECT name, type
|
|
68
|
+
for column_name, data_type, not_null in self.con.execute(f'''
|
|
69
|
+
SELECT name, type, "notnull"
|
|
69
70
|
FROM pragma_table_info('{table_name}')
|
|
70
71
|
'''):
|
|
71
|
-
column = Column(table, column_name, data_type)
|
|
72
|
+
column = Column(table, column_name, data_type, not_null == 0)
|
|
72
73
|
table.columns.append(column)
|
|
73
74
|
|
|
74
75
|
# Find primary keys.
|
|
@@ -56,7 +56,10 @@ class SchemaDrawer(Drawer):
|
|
|
56
56
|
@staticmethod
|
|
57
57
|
def __column_to_html(table: Table, column: Column, fk_counter: Dict[str, int]):
|
|
58
58
|
name = column.name
|
|
59
|
+
|
|
59
60
|
data_type = column.data_type
|
|
61
|
+
if column.null:
|
|
62
|
+
data_type += ' (NULL)'
|
|
60
63
|
|
|
61
64
|
# extract and style column name
|
|
62
65
|
if table.primary_key is not None and column in table.primary_key.columns:
|
|
@@ -2,7 +2,7 @@ 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
4
|
duckdb_kernel/kernel.py,sha256=wGHvQRhCu6aHvIRPQYJwb9PfRTYju4kYGx5yIeBsPvw,18666
|
|
5
|
-
duckdb_kernel/db/Column.py,sha256=
|
|
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
|
|
8
8
|
duckdb_kernel/db/DatabaseError.py,sha256=43zl8yym1f-fxH_UtGIbWnDnBE_TRwr9aCziY9t40QY,41
|
|
@@ -11,12 +11,12 @@ duckdb_kernel/db/Table.py,sha256=6M_CTBV3QlrL_7CdYfu6s9LelXBQ5RdMUAyntE6xcDI,746
|
|
|
11
11
|
duckdb_kernel/db/__init__.py,sha256=PKQYQDCW7VQYxmzhQK6A0Qloka9FdMfeFQMfY-CjBSA,198
|
|
12
12
|
duckdb_kernel/db/error/EmptyResultError.py,sha256=N9Oxi2HDZBKaRQsfRsWpJJGOYX4BjdQqWOU-XvzUzNY,92
|
|
13
13
|
duckdb_kernel/db/error/__init__.py,sha256=oHfhfbcfyTJ3pAPN835omdQcebvJTauuULFx5gm9rq4,47
|
|
14
|
-
duckdb_kernel/db/implementation/duckdb/Connection.py,sha256=
|
|
14
|
+
duckdb_kernel/db/implementation/duckdb/Connection.py,sha256=znJ9mTbE4pjCLTVY_10PRAq_mv7NnxnnOuXOkKCNtSo,6395
|
|
15
15
|
duckdb_kernel/db/implementation/duckdb/__init__.py,sha256=HKogB1es4wOiQUoh7_eT32xnUFLmzoCyR_0LuY9r8YQ,35
|
|
16
|
-
duckdb_kernel/db/implementation/postgres/Connection.py,sha256=
|
|
16
|
+
duckdb_kernel/db/implementation/postgres/Connection.py,sha256=K8DRKJ5UyAJgRhMMIivhfUNzFIDarc_EmwCuRaPBGQ0,8810
|
|
17
17
|
duckdb_kernel/db/implementation/postgres/__init__.py,sha256=HKogB1es4wOiQUoh7_eT32xnUFLmzoCyR_0LuY9r8YQ,35
|
|
18
18
|
duckdb_kernel/db/implementation/postgres/util.py,sha256=4nr1mqXhlwkMVXbJSfJ7dRlUm6UskpvgKApe7GRwmBI,281
|
|
19
|
-
duckdb_kernel/db/implementation/sqlite/Connection.py,sha256=
|
|
19
|
+
duckdb_kernel/db/implementation/sqlite/Connection.py,sha256=51I9G03PRLmreV2vlb7VVYjooAW13vlcFnimNuliLdo,6888
|
|
20
20
|
duckdb_kernel/db/implementation/sqlite/__init__.py,sha256=HKogB1es4wOiQUoh7_eT32xnUFLmzoCyR_0LuY9r8YQ,35
|
|
21
21
|
duckdb_kernel/magics/MagicCommand.py,sha256=OoQ6j4cNtIYjaK4MPVzJyv1eYTNu4_a7qoRx-5G3Hg0,2346
|
|
22
22
|
duckdb_kernel/magics/MagicCommandCallback.py,sha256=r1kkJyRR7sZnrnlMH3w4bGqDAJL-BVTIB4-Kn66ynlM,764
|
|
@@ -66,7 +66,7 @@ duckdb_kernel/parser/elements/unary/__init__.py,sha256=48EDygy0pD7l3J_BlXGc-b7HY
|
|
|
66
66
|
duckdb_kernel/parser/tokenizer/Token.py,sha256=vwN5hHg11kqzOHLeL5GO1c1BbCTZzYDTuy0QR4kDzew,1800
|
|
67
67
|
duckdb_kernel/parser/tokenizer/Tokenizer.py,sha256=PWGgS7gYgpULiKGDho842UbaXuqmwEkccixuF10oi5g,5081
|
|
68
68
|
duckdb_kernel/parser/tokenizer/__init__.py,sha256=EOSmfc2RJwtB5cE1Hhj1JAra97tckxxS8-legybPy60,58
|
|
69
|
-
duckdb_kernel/parser/util/RenamableColumn.py,sha256
|
|
69
|
+
duckdb_kernel/parser/util/RenamableColumn.py,sha256=-wajWBUH-IgucoF7zRxoNPgD5syUOcKzE4crqFUXlXg,672
|
|
70
70
|
duckdb_kernel/parser/util/RenamableColumnList.py,sha256=GfhdGv4KYT64Z9YA9TCn-7hhcEcc3Gu3vI2zMZ52w-8,3015
|
|
71
71
|
duckdb_kernel/parser/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
72
|
duckdb_kernel/util/ResultSetComparator.py,sha256=RZDIfjJyx8-eR-HIqQlEYgZd_V1ympbszpVRF4TlA7o,2262
|
|
@@ -74,9 +74,9 @@ duckdb_kernel/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
74
74
|
duckdb_kernel/util/formatting.py,sha256=cbt0CtERnqtzd97mLrOjeJpqM2Lo6pW96BjAYqrOTD8,793
|
|
75
75
|
duckdb_kernel/visualization/Drawer.py,sha256=D0LkiGMvuJ2v6cQSg_axLTGaM4VXAJEQJAynvedQ3So,296
|
|
76
76
|
duckdb_kernel/visualization/RATreeDrawer.py,sha256=j-Vy1zpYMzwZ3CsphyfPW-J7ou9a9tM6aXXgAlQTgDI,2128
|
|
77
|
-
duckdb_kernel/visualization/SchemaDrawer.py,sha256=
|
|
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.2.
|
|
80
|
-
jupyter_duckdb-1.1.2.
|
|
81
|
-
jupyter_duckdb-1.1.2.
|
|
82
|
-
jupyter_duckdb-1.1.2.
|
|
79
|
+
jupyter_duckdb-1.1.2.3.dist-info/METADATA,sha256=AIaFEwo-rCuGgM4HxS7MaXQIfZn8bEpI2jqk-LBHiaY,7764
|
|
80
|
+
jupyter_duckdb-1.1.2.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
81
|
+
jupyter_duckdb-1.1.2.3.dist-info/top_level.txt,sha256=KvRRPMnmkQNuhyBsXoPmwyt26LRDp0O-0HN6u0Dm5jA,14
|
|
82
|
+
jupyter_duckdb-1.1.2.3.dist-info/RECORD,,
|
|
File without changes
|