I really hate when I want to store/fetch something from the database, I have to issue a SQL command and wait for the response, and before that I need to create the table and think carefully about the data types. The code is replicates all over the source, every time I need to talk to SQL I am very tired.
I am thinking about is there any easy way of this? Like when I want to insert a line to a table:
Table1 table;
table.insert("bbb", "ccc", "ddd");
table.insert("colA":"bbb", "colB":"ccc");
Also I don’t need to create the table in SQL manually, just declare in the high level language:
Table1 {
colA
colB
}
To find the specific element:
table.find({"colA" = "bbb"});
Or, even better, if the data is stored in XML style, we don’t need to make every row the same columns, it’s free style.
You know what I mean.
Is there existing ones with good high level language support? Python?
What you may be looking for is an ORM (Object-Relational Mapping) library, which abstracts you from the database so that you don’t have to write SQL in many cases. In regard to your question about Python–yes, dynamic languages like Python and Ruby are good for this sort of thing. But ORM libraries are available in just about any language. The second possibility is NoSQL.
ORM
I’ll give you a couple quick examples in Ruby on Rails, using its built-in ORM, ActiveRecord. Let’s say you have a ‘users’ table with ‘name’ and ‘age’ columns.
Inserting into the table:
Finding records:
ActiveRecord even creates dynamic methods based on your columns:
Specifying a table is indeed simple and declarative. There are quite a few tutorials and screencasts available, if you’re interested.
NoSQL
If you don’t need a relational database, then NoSQL may fit the bill. These tend to be specialized for certain types of data, and usually optimized for performance. Examples are MongoDB, CouchDB for general purpose document databases, Redis for key/value store, eXist for XML storage. Many options are listed at http://nosql-database.org/. Most of these have language bindings for dynamic languages such as Python.