Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQlite and dataframes #275

Open
jondan99 opened this issue Nov 28, 2021 · 2 comments
Open

SQlite and dataframes #275

jondan99 opened this issue Nov 28, 2021 · 2 comments

Comments

@jondan99
Copy link

jondan99 commented Nov 28, 2021

Hello

I am reading a sqlite table into a dataframe, where one column is
r real
and all values are missing. I use
df=DBInterface.execute(db, sql) |> DataFrame;
and get df.r to be of type missing (think it should be Union{Missing,Float64} )
SQLite.jl returns the correct type, but it does not make it when converted to a dataframe.

not sure if this is a bug, but thought I would let you all know

best, jack

@nalimilan
Copy link

This is probably due to:

return nothing # fallback to the actual column types of the result

@quinnj What's the reason for using the actual content types instead of the ones declared in the SQL table?

@quinnj
Copy link
Member

quinnj commented Dec 2, 2021

This is the default definition because in sqlite, declared column types are just "suggestions" instead of any kind of real constraint. Indeed, you can declare a column type to be DOUBLE, but then insert as many strings as you want and it won't complain. Hence we ran into too many issues where this "flexibility" caused issues when trying to query data from a table.

I think we should bring back the stricttypes::Bool=false keyword argument though, so you could do DBInterface.execute(db, sql; stricttypes=true) and it would produce a Tables.Schema that returns the declared column types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants