JuliaDatabases / DBInterface.jl

Database interface definitions for Julia
https://juliadatabases.org/DBInterface.jl/dev/
Other
84 stars 12 forks source link

Overloading over other basic functions #8

Closed bramtayl closed 9 years ago

bramtayl commented 9 years ago

It seems possible to take advantage of Julia's overloading capabilities and create special methods of open and close for databases, and likewise, special methods of DataFrames' readtable and writetable for moving tables in and out of databases (or DataFrames functions). While I'm thinking of it, it might also be possible to overload DataFrames' readtable and writetable over base read and write. R's dplyr implements this system rather well (which would correspond with overloading DataFramesMeta functions). In fact, I think with a bit of wit, it might be possible to overload most or all of DBI's proposed system over base functions. The end goal would be being able to do everything with a database that you could do with a set of DataFrames. Julia doesn't have a named list/dict/map type (I think?), but it seems like the natural analog to a named list of DataFrames in a database (and a source for functions to overload). Going further with this, it might be possible for Julia to have a native database type that could allow many of the schema type things available in databases, or basically implement a version of SQL in Julia (again, think a dplyr kind of system). In many cases, these kinds of things would require making decisions about which method to use based on file extension, which might take a bit of work to make compatible with Julia's type system (perhaps a new set of types based on file types). Also, a special type for SQL calls. In fact, couldn't Julia create a set of expression-like types for every foreign language/protocol (in the vein of shell commands and Regex patterns), AND convert functions? Overloading not only simplifies code and learning, but is also a huge part of what makes Julia Julia.

Edit: See JuliaLang/julia#11835

johnmyleswhite commented 9 years ago

Like JuliaLang/julia#11835, I think this issue is too broad to be actionable.

@bramtayl: It would be a big favor to me if you tried to avoid opening issues that are excessively abstract. If you have a design that you'd like to experiment with, please develop a prototype and post the results to julia-users for discussion.

bramtayl commented 9 years ago

Did you a huge favor https://groups.google.com/forum/#!topic/julia-users/YsSuDEkZtUQ