FunSQL.jl
FunSQL.jl copied to clipboard
Julia library for compositional construction of SQL queries
```julia using FunSQL: SQLTable, From, Define, Where, Get, render person = SQLTable(:person, :person_id, :year_of_birth, :location_id) ByYOB(yob) = (q = Define(:yob => Get.year_of_birth)) |> Where(q.yob .== yob) q = From(person) |>...
```julia using FunSQL: SQLTable, From, Select, Join, Where, Group, Define, Bind, Fun, Get, Agg, Var, render visit_occurrence = SQLTable(:visit_occurrence, :visit_occurrence_id, :person_id, :visit_start_date, :visit_end_date) condition_occurrence = SQLTable(:condition_occurrence, :condition_occurrence_id, :person_id, :condition_start_date, :condition_end_date)...
```julia using FunSQL: SQLTable, From, Select, Join, Where, Group, Define, Fun, Get, Agg, render person = SQLTable(:person, :person_id, :year_of_birth, :location_id) q = Define(:complex_expression => From(person) |> Group() |> Select(Agg.count())) |>...
Sometimes it is easier to remove columns from the default output than to build the new output list. A new node, `Unselect()`, should do it.
One point of friction using FunSQL.jl is that I still often need to switch between two different syntax. I still need to write SQL in a query editor while debugging...
Currently, `Define` adds any new columns at the end of the current column list. This is fine as the default behavior, but it should be possible to insert them at...