Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/build_linux_arm64_wheels-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
echo "Installing dependencies for Python $version"
pyenv shell $version
python -m pip install --upgrade pip
python -m pip install setuptools tox pandas pyarrow twine psutil deltalake wheel
python -m pip install setuptools tox pandas pyarrow twine psutil deltalake wheel jupyter nbconvert
pyenv shell --unset
done
- name: Install clang++ for Ubuntu
Expand Down Expand Up @@ -187,6 +187,15 @@ jobs:
pyenv shell --unset
done
continue-on-error: false
- name: Run notebook tests
run: |
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
pyenv shell 3.8
python -m pip install dist/*.whl --force-reinstall
jupyter nbconvert --to notebook --execute tests/test_data_insertion.ipynb --output test_data_insertion_output.ipynb
pyenv shell --unset
continue-on-error: false
- name: Check and upload core files if present
if: always()
run: |
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/build_linux_x86_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
echo "Installing dependencies for Python $version"
pyenv shell $version
python -m pip install --upgrade pip
python -m pip install setuptools tox pandas pyarrow twine psutil deltalake wheel
python -m pip install setuptools tox pandas pyarrow twine psutil deltalake wheel jupyter nbconvert
pyenv shell --unset
done
- name: Install clang++ for Ubuntu
Expand Down Expand Up @@ -186,6 +186,15 @@ jobs:
pyenv shell --unset
done
continue-on-error: false
- name: Run notebook tests
run: |
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
pyenv shell 3.8
python -m pip install dist/*.whl --force-reinstall
jupyter nbconvert --to notebook --execute tests/test_data_insertion.ipynb --output test_data_insertion_output.ipynb
pyenv shell --unset
continue-on-error: false
- name: Check and upload core files if present
if: always()
run: |
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/build_macos_arm64_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo "Installing dependencies for Python $version"
pyenv shell $version
python -m pip install --upgrade pip
python -m pip install setuptools wheel tox pandas pyarrow twine psutil deltalake wheel>=0.40.0
python -m pip install setuptools wheel tox pandas pyarrow twine psutil deltalake wheel>=0.40.0 jupyter nbconvert
pyenv shell --unset
done
- name: Remove /usr/local/bin/python3
Expand Down Expand Up @@ -190,6 +190,15 @@ jobs:
pyenv shell --unset
done
continue-on-error: false
- name: Run notebook tests
run: |
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
pyenv shell 3.8
python -m pip install dist/*.whl --force-reinstall
jupyter nbconvert --to notebook --execute tests/test_data_insertion.ipynb --output test_data_insertion_output.ipynb
pyenv shell --unset
continue-on-error: false
- name: Check and upload core files if present
if: always()
run: |
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/build_macos_x86_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo "Installing dependencies for Python $version"
pyenv shell $version
python -m pip install --upgrade pip
python -m pip install setuptools tox pandas pyarrow twine psutil deltalake wheel>=0.40.0
python -m pip install setuptools tox pandas pyarrow twine psutil deltalake wheel>=0.40.0 jupyter nbconvert
pyenv shell --unset
done
- name: Remove /usr/local/bin/python3
Expand Down Expand Up @@ -191,6 +191,15 @@ jobs:
pyenv shell --unset
done
continue-on-error: false
- name: Run notebook tests
run: |
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
pyenv shell 3.8
python -m pip install dist/*.whl --force-reinstall
jupyter nbconvert --to notebook --execute tests/test_data_insertion.ipynb --output test_data_insertion_output.ipynb
pyenv shell --unset
continue-on-error: false
- name: Check and upload core files if present
if: always()
run: |
Expand Down
15 changes: 15 additions & 0 deletions src/Client/ClientBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,21 @@ bool isStdinNotEmptyAndValid(ReadBuffer & std_in)
{
try
{
// Use non-blocking check for stdin to avoid hanging
if (auto * fd_buffer = typeid_cast<ReadBufferFromFileDescriptor *>(&std_in))
{
int fd = fd_buffer->getFD();
if (fd == STDIN_FILENO)
{
int flags = fcntl(fd, F_GETFL);
if (flags != -1)
{
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
SCOPE_EXIT({ fcntl(fd, F_SETFL, flags); });
return !std_in.eof();
}
}
}
return !std_in.eof();
}
catch (const Exception & e)
Expand Down
78 changes: 78 additions & 0 deletions tests/test_data_insertion.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"cells": [
{
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-17T06:03:01.458132Z",
"start_time": "2025-09-17T06:03:00.939968Z"
}
},
"source": [
"print(\"start\")\n",
"from chdb import session\n",
"print(\"Connecting to database\")\n",
"chs = session.Session()\n",
"print(\"Creating database\")\n",
"chs.query(\"CREATE DATABASE IF NOT EXISTS movie_embeddings ENGINE = Atomic\")\n",
"print(\"Creating table\")\n",
"chs.query(\"USE movie_embeddings\")\n",
"chs.query('DROP TABLE IF EXISTS embeddings')\n",
"chs.query('DROP TABLE IF EXISTS embeddings_with_title')\n",
"\n",
"print(\"Creating table with movie titles\")\n",
"\n",
"chs.query(\"\"\"CREATE TABLE embeddings (\n",
" movieId UInt32 NOT NULL,\n",
" embedding Array(Float32) NOT NULL\n",
" ) ENGINE = MergeTree()\n",
" ORDER BY movieId\"\"\")\n",
"\n",
"print(\"Inserting movie embeddings into the database\")\n",
"\n",
"# Insert from INFILE and VALUES got stuck either\n",
"# chs.query(\"INSERT INTO embeddings FROM INFILE 'movie_embeddings.csv' FORMAT CSV\")\n",
"chs.query(\"INSERT INTO embeddings VALUES (1, [1,2,3,4,5,6,7,8,9,10])\")\n",
"print(chs.query('SELECT * FROM embeddings LIMIT 5'))"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"start\n",
"Connecting to database\n",
"Creating database\n",
"Creating table\n",
"Creating table with movie titles\n",
"Inserting movie embeddings into the database\n",
"1,\"[1,2,3,4,5,6,7,8,9,10]\"\n",
"\n"
]
}
],
"execution_count": 1
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading