Iβm trying out Octo.jl with DuckDB. I managed to connect to an existing file and query a table there.
julia> import DataFrames as DF;
julia> using Octo.Adapters.DuckDB
julia> con = Repo.connect(adapter=Octo.Adapters.DuckDB, file="test/data/norse.duckdb")
Octo.Repo.Connection(false, "DuckDB", Main.DuckDBLoader, Octo.Adapters.DuckDB, DuckDB.DB("test/data/norse.duckdb"))
julia> struct Assets end
julia> Schema.model(Assets, table_name="alt_assets", primary_key="name")
| primary_key | table_name |
| ------------- | ------------ |
| name | alt_assets |
julia> assets = from(Assets)
FromItem alt_assets
julia> [SELECT * FROM assets LIMIT 5]
SELECT * FROM alt_assets LIMIT 5
julia> Repo.query([SELECT * FROM assets LIMIT 5]) |> DF.DataFrame
5Γ21 DataFrame
Row β name type active investable investment_integer variable_cost inv β―
β String? String? Bool? Bool? Bool? Float64? Flo β―
ββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 β Asgard_Battery storage true true true 0.003 β―
2 β Asgard_Solar producer true true true 0.001
3 β Asgard_E_demand consumer true false false 0.0
4 β Asgard_CCGT conversion true false true 0.0015
5 β G_imports producer true false false 0.08 β―
However now I want to query CSV files (the reason for using DuckDB), but Iβm unsure how to call database functions like read_csv_auto
.
Hoping to get some hints on how to proceed.