-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds
from_query
w hidden docs portion for now, bumps version, updat…
…es news
- Loading branch information
Showing
9 changed files
with
109 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# TidierDB.jl updates | ||
|
||
## v0.1.2 - 2024-05-TBD | ||
- Adds `@full_join`, `@semi_join`, `@anti_join` | ||
- Adds `connect()` - a universal connection funciton for all supported backends | ||
- Adds `sql_agg()` - allows any aggregate SQL function not availabe in backend parsers to be used in `@mutate`. Simply write the function as written in SQL syntax as a string wrapped in `sql_agg`, and subsequent windowing is handled by `@mutate`. | ||
|
||
## v0.1.1 - 2024-04-12 | ||
- Fixes metadata retrieval for MariaDB | ||
- allows for Table.Name style naming in `@select` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# While using TidierDB, you may need to generate part of a query and reuse it multiple times. `from_query()` enables a query portion to be reused multiple times as shown below. | ||
|
||
# ```julia | ||
# import TidierDB as DB | ||
# con = DB.connect(:duckdb) | ||
# DB.copy_to(con, "https://gist.githubusercontent.com/seankross/a412dfbd88b3db70b74b/raw/5f23f993cd87c283ce766e7ac6b329ee7cc2e1d1/mtcars.csv", mtcars2) | ||
# ``` | ||
|
||
# Start a query to analyze fuel efficiency by number of cylinders. However, to further build on this query later, end the chain without using `@show_query` or `@collect` | ||
# ```julia | ||
# query = DB.@chain DB.db_table(con, :mtcars2) begin | ||
# DB.@group_by cyl | ||
# DB.@summarize begin | ||
# across(mpg, (mean, minimum, maximum)) | ||
# num_cars = n() | ||
# end | ||
# DB.@mutate begin | ||
# efficiency = case_when( | ||
# mean_mpg >= 25, "High", | ||
# mean_mpg >= 15, "Moderate", | ||
# "Low" ) | ||
# end | ||
# end; | ||
# ``` | ||
|
||
# Now, `from_query` will allow you to reuse the query to calculate the average horsepower for each efficiency category | ||
# ```julia | ||
# DB.@chain DB.from_query(query) begin | ||
# DB.@left_join(mtcars2, cyl, cyl) | ||
# DB.@group_by(efficiency) | ||
# DB.@summarize(avg_hp = mean(hp)) | ||
# DB.@collect | ||
# end | ||
# ``` | ||
# ``` | ||
# 2×2 DataFrame | ||
# Row │ efficiency avg_hp | ||
# │ String? Float64? | ||
# ─────┼────────────────────── | ||
# 1 │ Moderate 180.238 | ||
# 2 │ High 82.6364 | ||
# ``` | ||
|
||
# Reuse the query again to find the car with the highest MPG for each cylinder category | ||
# ```julia | ||
# DB.@chain DB.from_query(query) begin | ||
# DB.@left_join(mtcars2, cyl, cyl) | ||
# DB.@group_by cyl | ||
# DB.@slice_max(mpg) | ||
# DB.@select model cyl mpg | ||
# DB.@collect | ||
# end | ||
# ``` | ||
# ``` | ||
# 3×3 DataFrame | ||
# Row │ model cyl mpg | ||
# │ String? Int64? Float64? | ||
# ─────┼──────────────────────────────────── | ||
# 1 │ Pontiac Firebird 8 19.2 | ||
# 2 │ Toyota Corolla 4 33.9 | ||
# 3 │ Hornet 4 Drive 6 21.4 | ||
# ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters