Skip to content

Commit 3d54cb1

Browse files
committed
update
1 parent 80d5e78 commit 3d54cb1

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.0.2
2+
3+
1. 修复bug
4+
2. 更新jupyter相关依赖项
5+
16
# 0.0.1
27

38
1. 增加类型注释

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ keywords: jupyter,jupyter-kernel,postgresql,sql
1919
1. 加入常用可视化功能
2020
2. 改用魔术命令配置连接信息
2121

22-
<!-- ## 安装
22+
## 安装
2323

24-
`pip install postgresql_kernel` -->
24+
`pip install postgresql_kernel`
2525

2626
## 使用
2727

postgresql_kernel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""An PG kernel for Jupyter"""
22

3-
__version__ = '0.0.1'
3+
__version__ = '0.0.2'
44

55
from .kernel import PostgreSQLKernel
66

postgresql_kernel/kernel.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
from pathlib import Path
88
from select import select
99

10-
from traitlets import Dict
10+
from traitlets import Dict as tDict
1111
from metakernel import MetaKernel, ExceptionWrapper
1212
# from IPython.display import Image, SVG
1313

1414
from tabulate import tabulate
1515
import psycopg2
1616
from psycopg2 import Error, OperationalError
1717
from psycopg2.extensions import (
18-
QueryCanceledError, POLL_OK, POLL_READ, POLL_WRITE, STATUS_BEGIN, Union
18+
QueryCanceledError, POLL_OK, POLL_READ, POLL_WRITE, STATUS_BEGIN
1919
)
20-
from typing import Any, List, Optional, TypedDict, Iterable, Sequence, Mapping, Union, Tuple
20+
from typing import Any, List, Optional, TypedDict, Iterable, Sequence, Mapping, Union, Tuple, Dict
2121
from . import __version__
2222

2323
KernelDictType = TypedDict(
@@ -79,7 +79,7 @@ def get_kernel_json() -> KernelDictType:
7979
return data
8080

8181

82-
def wait_select_inter(conn: psycopg2.connection) -> None:
82+
def wait_select_inter(conn: "psycopg2.connection") -> None:
8383
"""等待连接建立.
8484
8585
Args:
@@ -111,7 +111,7 @@ class MissingConnection(Exception):
111111

112112

113113
class RowsDisplay:
114-
def __init__(self, header: Union[str, Mapping[str, str], Sequence[str]], rows: Union[Mapping[str, Iterable], Iterable[Iterable]]) -> None:
114+
def __init__(self, header: Union[str, Dict[str, str], Sequence[str]], rows: Union[Mapping[str, Iterable], Iterable[Iterable]]) -> None:
115115
self.header = header
116116
self.rows = rows
117117

@@ -132,13 +132,13 @@ class PostgreSQLKernel(MetaKernel):
132132
implementation_version: str = __version__
133133
language: str = 'sql'
134134
help_links: List[HelpLinkDictType] = HELP_LINKS
135-
kernel_json: Dict = Dict(get_kernel_json()).tag(config=True)
135+
kernel_json: tDict = tDict(get_kernel_json()).tag(config=True)
136136
_language_version: Optional[str] = None
137137
_banner: Optional[str] = None
138138

139139
_conn_string: str
140140
_autocommit: bool
141-
_conn: Optional[psycopg2.connection]
141+
_conn: Optional["psycopg2.connection"]
142142

143143
@property
144144
def language_version(self) -> str:
@@ -160,7 +160,7 @@ def banner(self) -> Optional[str]:
160160
if self._conn is None:
161161
return 'not yet connected to a database'
162162
res = self.fetchone('SELECT VERSION();')
163-
if res and len(res) >= 1:
163+
if res and len(res) >= 1 and isinstance(res[0], str):
164164
self._banner = res[0]
165165
return self._banner
166166

setup.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = postgresql_kernel
3-
version = 0.0.1
3+
version = 0.0.2
44
author = hsz
55
author_email = hsz1273327@gmail.com
66
description = metakernel for postgres_kernel
@@ -33,11 +33,11 @@ setup_requires =
3333
wheel >= 0.36.2
3434
setuptools >= 47.1.0
3535
install_requires =
36-
metakernel >=0.24.0
36+
metakernel >= 0.24.0
3737
psycopg2-binary >= 2.9.3
3838
tabulate >= 0.8.9
39-
jupyter_client >=4.3.0
40-
ipykernel >= 6.0.1
39+
jupyter_client >= 7.1.1
40+
ipykernel >= 6.7.0
4141

4242
[options.packages.find]
4343
include =

0 commit comments

Comments
 (0)