Archive for July, 2007

Libgda: running SELECT SQL commands on CSV files

Wednesday, July 18th, 2007

I recently spent some time in Libgda’s code to implement a new type of connection which lets the user run SQL commands on tables defined as data model objects (the GdaDataModel is itself an interface with various implementations).

The operating mode is easy: create a new connection, add data models to it which will be represented as tables, and then run SQL as for a normal connection. There are of course limitations due to the fact that all of this is implemented using the virtual tables feature of SQLite, and some performances limitations dues to the early nature of the code.

In the future, I plan to enhance the concept further by being able to run SQL commands on the tables of several connections, to enable direct data migration or comparison from different databases for example.

To illustrate this, SNV trunk now holds an example which computes information from two different CSV files (in samples/Virtual).