queryverse / QuerySQLite.jl

SQLite backend for Query.jl
Other
4 stars 2 forks source link

error using the in operator #33

Open pstaabp opened 4 years ago

pstaabp commented 4 years ago

I was trying to do a filter for a value in an array. Here's an example using the Chinook db:

using Query, QuerySQLite
database = Database(joinpath(pathof(QuerySQLite) |> dirname |> dirname, "test", "Chinook_Sqlite.sqlite"))
database.Track |> @filter(_.AlbumId in [1,5,9])

which returns the error:

SQLite.SQLiteException("no such table: 1, 5, 9")

and piping to get_sql has [ ] around the array, where SQL needs parens ( ).

If we run:

using SQLite, DataFrames
result = DBInterface.execute(db,"SELECT * FROM (Track) WHERE AlbumId IN (1, 5, 9)") |> DataFrame

we get the expected results.

bramtayl commented 4 years ago

Oops, sorry I missed this! I'll take a look at it tomorrow.

bramtayl commented 4 years ago

I'm not sure if I want to support this...the SQL syntax is a tuple, which works fine. I think maybe instead, if you try to use a raw vector in QuerySQLite, I could throw an error and suggest using a tuple instead?