csvbase is a simple website for sharing table data. Join the discord.
Using HTTPS, or the csvbase-client, to import/export csvbase tables with DuckDB
duckdb
shellWhen using the DuckDB shell (ie: you've run duckdb
), you can read any table
from csvbase with a line like the following:
select * from read_parquet("https://csvbase.com/meripaterson/stock-exchanges.parquet");
The above uses DuckDB's httpfs extension. It also uses csvbase's Parquet output format, which works well with DuckDB.
You can also use plain csv:
select * from read_csv_auto("https://csvbase.com/meripaterson/stock-exchanges.csv");
But that is, generally, slower.
duckdb
Python driverIf you're using the Python driver for duckdb you can also use csvbase-client
to write back to csvbase.
First, install both duckdb (the Python library) and csvbase-client.
# install duckdb and the csvbase-client
pip install duckdb csvbase-client
Then, in Python:
import duckdb, fsspec
# teach DuckDB the csvbase:// url scheme
duckdb.register_filesystem(fsspec.filesystem('csvbase'))
# create a duckdb table called "stock_exchanges"
duckdb.sql("""
CREATE TABLE stock_exchanges
AS FROM read_csv_auto('csvbase://meripaterson/stock-exchanges')
""")
# write that local duckdb table back to my own csvbase account as a public table
duckdb.sql("""
COPY stock_exchanges TO
'csvbase://calpaterson/duckdb-example?public=true' (HEADER, DELIMITER ',')
""")
Note the following:
?public=true
when first posting to create a public table