Toress
Toress

Reputation: 1031

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.

Upvotes: 11

Views: 1986

Answers (1)

Donal Fellows
Donal Fellows

Reputation: 137567

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.)

Upvotes: 15

Related Questions