GeezerVison is showing github.com — Systematic way of dealing with nested queries · Issue #7 · queryverse/QuerySQLite.jl
Systematic way of dealing with nested queries #7
Description
I tried this query on the Chinook db:
db.Track |> @select(:AlbumId, :Composer) |> @mutate(bar = _.AlbumId * 2)
and got an error. Should that work?
Activity
bramtayl commented on Dec 8, 2019
This is getting close to being user ready. I need to add some docs and write up the blog posts. Sorry it's been a busy semester.
I tried running the code, and it generates the following:
result = database.Track |> @select(:AlbumId, :Composer) |> @mutate(bar = _.AlbumId * 2)
translate(result.code)
SELECT AlbumId AS AlbumId, Composer AS Composer, AlbumId * 2 AS bar SELECT AlbumId AS AlbumId, Composer AS Composer FROM (Track)
Which is pretty close to being reasonable looking SQL code. I have already have an implementation of a nested query for the GROUP_BY translation, but it seems like it might need a more general implementation.
bramtayl commented on Dec 8, 2019
Ok, this works on master, so I'm closing it, but not a very satisfying solution. A more satisfying one would be a way to determine when SQL expressions need to be specifically marked as nested. I wonder how much would be lost if all SQL expressions were assumed to be nested? Can the SQLite optimizer optimize them away?
changed the title
[-]Error in a query[/-] [+]Systematic way of dealing with nested queries[/+] on Dec 9, 2019
Metadata
Metadata
Development
No branches or pull requestsIssue actions