Open mamcx opened 5 years ago
- Having a two-layer design similar to https://www.sqlalchemy.org, where the inner-layer is raw and
very dynamic and the upper layer is more type-oriented can work
How is this a trap? Or even in the scope of this project? Ideally you want to be able to support both of such layers from Rust-DBC.
- Only support records. Sql is relational. Is based in a "tabular" representation, alike a ndarray. With rows and columns. Can be array of hash maps to be simple (alike ado.net).
Granted SQL is relational. However - Relational Algebra is based upon Heterogenous Tuples† i.e. records. The mentioned tabular data is just a Record[]
.
†By Heterogenous Tuples I mean, when you execute following DDL:
SELECT name, age, gender FROM person
You get (varchar, int, char)
. Not all elements are of the same type.
To add my two cents to the discussion is below:
How is this a trap?
Sorry, was more like a observation than a trap.
Relational Algebra is based upon Heterogenous Tuples
Yes, I agree. I write this part poorly. I mean "just return a record as if is not a part of a set".
Possibly make dates & decimals optional
Normally I will be against this, but considering that crates make easy to mark something as optional, I think in rust is ok.
Tangential, maybe a way to declare "field types" so I can add after the fact a new kind of type. For example, imagine I need to turn a Json string inside some fields.
SQL interfaces look quite similar in other languages. For instance Golang/sql and Java/sql look almost identical, the Python DB-API and .NET seem to be a bit more different.
https://golang.org/pkg/database/sql/ https://docs.oracle.com/javase/10/docs/api/java/sql/package-summary.html
Does anyone have any preference as a starting point?
I'd advise everyone to steer clear of any API made by Oracle. They've proven they will get litigious when it comes to API.
I'd advise everyone to steer clear of any API made by Oracle.
Nit: owned by. But definitely agreed.
I think is good idea to define the scope of this crate. Also, to look at libraries/specifications like
Some traps I hope we avoid:
This is tied to the first point. Not asume I have a struct to put the data.
Is need a "serve" for turn the data/sql commands for different db engines. However, put the drivers in a separate crate, make easy to use the API to others and even on tests with mock data.
The base of this is very simple: Execute commands, return selects of many rows, return selects of scalars, alike micro-ORMs like https://github.com/StackExchange/Dapper