Skip to content

duckdb.read_parquet(uploaded_file) doesn't accept filepath like duckdb.read_csv(uploaded_file) does #216

@HeWhoHeWho

Description

@HeWhoHeWho

What happens?

In Streamlit, CSV file uploaded via streamlit.file_uploader can be parsed with duckdb.read_csv(uploaded_file) without issue.

However, using similar method to parse parquet file failed: duckdb.read_parquet(uploaded_file) despite filepath is stated to be the permitted argument. (source1) (source2)

Error message as follows:

TypeError: read_parquet(): incompatible function arguments. The following argument types are supported:
    1. (file_glob: str, binary_as_string: bool = False, *, file_row_number: bool = False, filename: bool = False, hive_partitioning: bool = False, union_by_name: bool = False, compression: object = None, connection: duckdb.DuckDBPyConnection = None) -> _duckdb.DuckDBPyRelation
    2. (file_globs: collections.abc.Sequence[str], binary_as_string: bool = False, *, file_row_number: bool = False, filename: bool = False, hive_partitioning: bool = False, union_by_name: bool = False, compression: object = None, connection: duckdb.DuckDBPyConnection = None) -> _duckdb.DuckDBPyRelation

Invoked with: UploadedFile(file_id=xxx, name=xxx, type=xxx, size=xxx, _file_urls=file_id=xxx, upload_url: xxx, delete_url: xxx)

To Reproduce

Any parquet file should allow reproduction of the bug.

import streamlit as st
import duckdb
import polars as pl

uploaded_file = st.file_uploader("Choose a file", type=["csv", "parquet"])

if uploaded file is not None:
    df = duckdb.read_parquet(uploaded_file).pl()
    st.dataframe(df.head())

OS:

Windows 11 Enterprise x86_64

DuckDB Package Version:

1.4.2

Python Version:

3.12.7

Full Name:

Anthony Who

Affiliation:

JP Morgan

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

I have tested with a stable release

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?

  • Yes, I have

Did you include all relevant configuration to reproduce the issue?

  • 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