Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import database of sqlite to mathematica

I want to use mathematica to analyze some data of sqlite?

But i don't know how to do that .

And I'm not sure whether mathematica support the data of sqlite.

like image 531
Toress Avatar asked Jan 21 '12 10:01

Toress


People also ask

How do I export SQLite Database to SQL?

You can export the structure and contents to a . sql file that can be read by just about anything. File > Export > Database to SQL file. Technically, the SQLite shell is not SQLite but a console application linked to SQLite which only is a library.

What is SQLite dump?

The . dump command converts the entire structure and data of an SQLite database into a single text file. By default, the . dump command outputs the SQL statements on screen. To issue the output to a file, you use the .


1 Answers

Apparently, SQLite support is already available in Mathematica though it is undocumented. As such, proceed carefully!

Open a database with:

db = Database`OpenDatabase["thefilename.sqlite"]

Then run SQL statements with:

results = Database`QueryDatabase[db, "SELECT foo FROM bar WHERE boo = ?", { "some string" }]

That should be enough for you to get going. (You have to pull data into Mathematica from the database to analyze it; nothing can be done while it is just “at rest” on disk. If you're doing complex analyses, it might be worth your while to put some of that in the SQL queries, especially if there are sensible indices set on the database.)

like image 95
Donal Fellows Avatar answered Oct 12 '22 13:10

Donal Fellows