3

I have a python project that needs to access sql data. I actually have the contents of this database as .sql files and I'm wondering what's the fastest/lightest way to run my project

  • The python project uses the import MySQLdb statement.
  • This led me to install pip install MySQL-python and brew install mysql-connector-c and then I'm trying to set up a MySQL server so I can finally run the program
  • If possible I'd like to avoid the huge official MYSQL editions I can find on the internet
  • I'm rather looking for lightweight alternatives

It it actually possible to find some lightweight (my)SQL server that would successfully let me connect from python or is there no avoiding the heavy official MySQL editions ?

  • 1
    Why not try SQLlite - otherwise all mySQL is the sort of the same size – Mark Apr 9 '17 at 23:24
1

I use DB Browser for SQLite. It's free and has the feature I need, but it's pretty lightweight, so you won't have some features like SQL Procs, etc. I think it supports triggers though, so I guess you can get around the no-sql-proc issue by writing some triggers.

The database runs on SQLite, which is a pretty popular free version of SQL, so you should be able to find compatible Python packages for it. Like these for example: 11.13. sqlite3 or 12.6. sqlite3, but I don't use Python so I haven't tried either of them.

Anyhow, it works well for me. I use it for managing data that's too messy to parse with excel. For doing analysis I use the Julia programing language (but Python should work just as well).

Edit: If you do decide to try SQLite and are wondering how to get your MySQL data into SQLite, here is a StackOverflow page that talks about exactly this.

  • But basically, in addition to the data conversion, any (python) code that uses mysql will be broken if I switch to sqlite and I have to fix the code to use a different library that most likely uses different DSL so I also have to go over all the code ? – Cyril Duchon-Doris May 7 '17 at 15:05
  • @CyrilDuchon-Doris This is true. So maybe be more hassle than it's worth, but it is free and light weight so I guess there's a trade off. – Vladimir May 19 '17 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .