Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

kimmolinna/DuckDB.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Julia C-API wrapper for DuckDB

Installation

pkg> add DuckDB

julia> using DuckDB

Basics

db = DuckDB.open(":memory:")

con = DuckDB.connect(db)

res = DuckDB.execute(con,"CREATE TABLE integers(date DATE, jcol INTEGER);")

res = DuckDB.execute(con,"INSERT INTO integers VALUES ('2021-09-27', 4), ('2021-09-28', 6), ('2021-09-29', 8);")

res = DuckDB.execute(con, "SELECT * FROM integers;")

df = DuckDB.toDataFrame(res)

# or

df = DuckDB.toDataFrame(con, "SELECT * FROM integers;")

res = DuckDB.execute(con, "COPY (SELECT * FROM integers) TO 'test.parquet' (FORMAT 'parquet');")

res = DuckDB.execute(con, "SELECT * FROM 'test.parquet';")

DuckDB.appendDataFrame(df, con, "integers")

DuckDB.disconnect(con)

DuckDB.close(db)