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

Multiple Dispatch for Conversion from Julia Types to SQL Types #12

Open
bosonbaas opened this issue Oct 30, 2020 · 2 comments
Open

Multiple Dispatch for Conversion from Julia Types to SQL Types #12

bosonbaas opened this issue Oct 30, 2020 · 2 comments

Comments

@bosonbaas
Copy link
Member

Currently, the conversion from Julia Types to SQL types is just facilitated by a dictionary between types.
While a solution other than hardcoding the type conversion would be preferable (maybe a more popular library that already maintains this map?), taking advantage of the Julia multiple dispatch system will make it a more flexible hardcoding.

@epatters
Copy link
Member

epatters commented Oct 30, 2020

Like you said, using multiple dispatch is more flexible than using a Dict{Type,Symbol} since you can do stuff like:

sql_type(::Type{<:Real}) = :Real
sql_type(::Type{<:Integer}) = :Int

Another complication is that different SQL DBs have very different data types, e.g. compare SQLite's minimalist data types to all the Postgres data types.

@jpfairbanks
Copy link
Member

That would be an indication that we should make an sql_type(::Type{PGSQLConverter}, t::T) or sql_type(::Type{SQLiteConverter}, t::T) function so that multiple backends can be added later.

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