does the following satisfy your requirement?
cat test.py import polars as pl import duckdb data = pl.DataFrame({"a":[1,2,3,]}) duckdb.sql("COPY (select * from data) to 'test.csv'") $ python test.py $ cat test.csv a 1 2 3