Skip to content

error using the in operator #33

Description

@pstaabp

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.

Activity

  1. bramtayl commented on Jul 16, 2020

    @bramtayl
    Collaborator

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

  2. bramtayl commented on Jul 17, 2020

    @bramtayl
    Collaborator

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions