I have a vector (of strings) that I want to left-join with an SQLite table (to find an “id” corresponding to each string). The SQLite table is too big to load into memory - but the left join should return only as many rows as my smaller vector of strings. I think Query.jl can do this, but I’m getting stuck trying to use the SQLite table in the query.
I have:
cursor = DBInterface.execute(db, "SELECT * from paths") # schema has (id INTEGER, path TEXT)
q = @from p1 in my_paths begin # my_paths is a Vector{String}
@left_outer_join p2 in cursor on p1 equals p2.path
@select {p2.id, p2.path}
@collect DataFrame
end
Using @allocated
, it looks like the DBInterface.execute
query here doesn’t immediately load the table into memory (which is good). But my Query.jl block fails with:
The keys in the join clause have different types, String and Any
It seems the SELECT query returns columns of type Any
, instead of the types in the SQLite schema
How do I get the SQLite cursor to return more specifically-typed data? Or, get Query.jl to convert the columns in the cursor from Any
, Any
to Int64
, String
?