Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using session.query("insert xxx") will stuck #260

Open
DanielMao1 opened this issue Aug 28, 2024 · 4 comments
Open

Using session.query("insert xxx") will stuck #260

DanielMao1 opened this issue Aug 28, 2024 · 4 comments
Labels
Notebook Jupiter Notebook and others

Comments

@DanielMao1
Copy link

(you don't have to strictly follow this form)

Describe the situation
What exactly works slower than expected?

How to reproduce

from chdb import session as chs

## Create DB, Table, View in temp session, auto cleanup when session is deleted.
sess = chs.Session()
sess.query("CREATE DATABASE IF NOT EXISTS db_xxx ENGINE = Atomic")
sess.query("CREATE TABLE IF NOT EXISTS db_xxx.log_table_xxx (x String, y Int) ENGINE = Log;")
sess.query("INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5);")
sess.query(
    "CREATE VIEW db_xxx.view_xxx AS SELECT * FROM db_xxx.log_table_xxx LIMIT 4;"
)
print("Select from view:\n")
print(sess.query("SELECT * FROM db_xxx.view_xxx", "Pretty"))

Expected performance
This code should work but it stucked on sess.query("INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5);")

Additional context
uname -a shows:

Linux ip-172-xx-xx-xx 5.19.0-1029-aws #30~22.04.1-Ubuntu SMP Thu Jul 13 17:17:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
@auxten
Copy link
Member

auxten commented Aug 28, 2024

Can't reproduce on my Linux.
Please open debug log by using:

sess.query("INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5);", "Debug")

and give me the log

@l1t1
Copy link

l1t1 commented Aug 28, 2024

good in my environment

root@localhost:~# python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from chdb import session as chs
>>>
>>> ## Create DB, Table, View in temp session, auto cleanup when session is deleted.
>>> sess = chs.Session()
>>> sess.query("CREATE DATABASE IF NOT EXISTS db_xxx ENGINE = Atomic")

>>> sess.query("CREATE TABLE IF NOT EXISTS db_xxx.log_table_xxx (x String, y Int) ENGINE = Log;")

>>> sess.query("INSERT INTO db_xxx.log_table_xxx VALUES ('a', 1), ('b', 3), ('c', 2), ('d', 5);")

>>> sess.query(
...     "CREATE VIEW db_xxx.view_xxx AS SELECT * FROM db_xxx.log_table_xxx LIMIT 4;"
... )

>>> print("Select from view:\n")
Select from view:

>>> print(sess.query("SELECT * FROM db_xxx.view_xxx", "Pretty"))
   ┏━━━┳━━━┓
   ┃ xy ┃
   ┡━━━╇━━━┩
1.a1 │
   ├───┼───┤
2.b3 │
   ├───┼───┤
3.c2 │
   ├───┼───┤
4.d5 │
   └───┴───┘

@DanielMao1
Copy link
Author

DanielMao1 commented Aug 30, 2024

@auxten @l1t1 Thank you for your apply! I tested it again and I found the "stuck" only appears when I using jupyter notebook in vscode (jupyter notebook in web interface is OK, strange to me):

image

@auxten
Copy link
Member

auxten commented Aug 30, 2024

Oh, I see. It's a known issue #152

@auxten auxten added the Notebook Jupiter Notebook and others label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Notebook Jupiter Notebook and others
Projects
None yet
Development

No branches or pull requests

3 participants