duckdb / duckdb/duckdb-python

.cursor() loses schema information

Open
#162 0 comments 0 reactions 0 assignees View on GitHub
needs triage
Dominant language
Python
Stars
186
Forks
113
Avg merge
13h 29m
Merged PRs (30d)
17

Description

### What happens?

Whenever .cursor is called the description says `Create a duplicate of the current connection` however it actually losses the relevant schema information and instead switches to main

### To Reproduce

```python3
con = duckdb.connect()
con.execute("CREATE SCHEMA IF NOT EXISTS other_schema")
con.execute("USE other_schema")
print(con.cursor().execute("SELECT current_schema()").fetchone())
```

### OS:

Linux x86_64

### DuckDB Package Version:

1.4.0

### Python Version:

3.11.9

### Full Name:

Julian Meyers

### Affiliation:

Independent

### What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

### Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

### Did you include all code required to reproduce the issue?

- [x] Yes, I have

### Did you include all relevant configuration to reproduce the issue?

- [x] Yes, I have

Contributor guide

Open the contributing guide

Research direction

Start by running the reported Python reproduction against the DuckDB Python package and inspect the implementation and tests for connection.cursor(). Trace how the active schema is handled when the cursor is created; done means con.cursor().execute("SELECT current_schema()").fetchone() still reports other_schema rather than main.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.