Skip to content

[Python] replacement scans do not work inside the table method #9134

@ned2

Description

@ned2

What happens?

When calling duck.table and providing it with a table identifier of a variable in scope that should be queryable via a replacement scan (eg a Pandas or Polars dataframe), the DuckDB Python client instead responds with:

CatalogException: Catalog Error: Table 'df' does not exist!

I discovered this by trying to adopt a common R pattern with dplyr/dbplyr, where you start your query with a relation formed from a table, and then build on top of it. The Python Relational API equivalent is:

duckdb.table("my_table").more().methods()

Which is much cleaner that what you currently need to do when your table identifier is a dataframe:

duckdb.sql("FROM my_table").more().methods()

To Reproduce

df = duckdb.values([1,2,3]).df()

duckdb.table("df")

OS:

Ubuntu 23.04

DuckDB Version:

0.9.0

DuckDB Client:

Python

Full Name:

Ned Letcher

Affiliation:

Thoughtworks

Have you tried this on the latest main branch?

I have tested with a release build (and could not test with a main build)

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions