Open buddha314 opened 7 years ago
Until Chapel has a database module, your best bet is to utilize the C interoperability to interface with a database that includes c bindings.
You can generate the wrapper code easily with the c2chapel tool.
To demonstrate this, I ran c2chapel $(brew --prefix sqlite)/include/sqlite3.h > SQLite3.chpl
to generate this code.
Here is an example code that uses this module to create a table within a SQL database. This code is not too pretty, due to the C-interop caveats that are dealt with such as casting data to C-types before calling C functions. Ideally, we'd like to abstract all of this C-interop away in a Chapel module, similar to what we do with the BLAS and LAPACK modules.
Thanks Ben! I'll take a look at this today. Is there a way to do this with Python as well?
Is there a way to do this with Python as well?
Chapel does not have built-in interoperability with Python like it does with C today, but it can be done by utilizing the combination of Chapel's C-interop and Python's C-interop.
If interested in trying this route, it might be worth checking out @marcoscleison's chapel-python module as a first step.
Looks like the source code for libpq
is packaged with Postgres itself Psycopg2 and a few others are based on libpq
so might be a good place to start.
Hey! What's that? It the full source code for libpqxx on GitHub so this one is gonna be easy, right?
Hi, I have few lines with Postgres tested in Chapel 1.15 here https://github.com/marcoscleison/chapel-postgres . It is only the binding with libpq.
I would like to suggest to design a common interface like http://php.net/manual/pt_BR/book.pdo.php in Php or Golang Sql https://golang.org/pkg/database/sql/ . I think that with common interface class definition and standardization would open to other the possibility to develop drivers for different SQL database flavors.
What do you think?
I would actually pay US American $$ to have this built if you have the bandwidth
Would something like sqlite work? I'm working on a library in my spare time, but I know sqlite isn't as fully featured as some of these databases.
For others following along, this has led to the creation of the Chapel Data Object package
We might close this issue once that package reaches sufficient maturity.
This is a need again since Marcos can't maintain CDO. Any other takers? I could scrounge up some dollars.
I would like to take up this issue. @buddha314
What better place to get data than a SQL database? Don't say "Hadoop", that's just wrong.