ClickHouse / ClickHouse/clickhouse-connect

Return column structure in case of empty resultset

Open
#257 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
521
Forks
159
Avg merge
1d 7h
Merged PRs (30d)
46

Description

### Describe the bug
Return column structure in case of empty resultset
### Steps to reproduce
1. Use the following query "SELECT 1 as 'column1' LIMIT 0"

### Expected behaviour
Have a new setting, which will change behaviour in case of an empty result set being returned.

In case of pandas, `driver.query_df(ch_query)` should return `pd.DataFrame({'column1' : [] })`

This was resolved in the previous driver here https://github.com/ClickHouse/ClickHouse/issues/33522

Contributor guide

Open the contributing guide

Research direction

Start with the query_df entry point and its handling of empty result sets, then compare the intended behavior with ClickHouse issue #33522. Done means SELECT 1 AS 'column1' LIMIT 0 can return a pandas DataFrame containing column1 with no rows, controlled by the requested setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.