MySQL Workbench

DBMS, Scripting, Git experiences on Mac – (Very belated) Interlude

Over the  (2016) Christmas holidays, I started to try to work on the UQ course chooser. But for some reason, I never finished posting the blog. Sigh… So, here are a few random thoughts and some of the issues I encountered while working on the project at the very beginning, with only my MacBook Pro to develop on.

Git on Mac

  • Git on Windows is actually easier because the git bash app doesn’t remember the password. Git on Mac tries to use Apple Keychain to remember the password but it wouldn’t let me actually enter the password. Even in Unix with the hidden password entry. I ended up installing SourceTree to manage the git repositories on my Mac laptop.
    • On Windows, I’m still using Git Bash which now has broken so I have had to resort to using Git inside of the Linux Subsystem for Windows.
    • Though of course, I can still use Git inside PyCharm, my IDE of choice so far.

Now, about a year later I’ve been doing a lot more development on Mac and seem to have fixed the login issues. (I think I got a new version from Git and that was better.) I’m still using SourceTree because it’s easier to see the differences.)

MySQL on Mac

  • The Windows installer included everything. The Mac installer separates out the Workbench from the Server and Utilities. I first installed the Workbench cause I that’s all I needed initially, then I wanted to use the database and of course the database server itself wasn’t installed so I had to instal that separately.
  • After that I still had problems getting it working on the command line. The installer didn’t add it to $PATH – I had to look up what was wrong, and how to fix it manually. Following instructions on the internet, I had to add the symlink /usr/local/mysql/bin to $PATH
  • Then have to reset the default password
  • ALTER USER ‘root’@’localhost’ IDENTIFIED BY [password];

Now, just now, when I tried to run queries in MySQL Workbench, the application wouldn’t even run a simple query. When I used Google to search for [mysql workbench crashes on query], the first result directed me to install the later version, then I just used the built-in Check For Updates and got the most recent update. This fixed my problem too, now it works fine again.

Python Database stuff

Have to get the MySQL drivers for Python from here.

After much wailing and gnashing of teeth (well, a bit anyway) I just decided to use PyMySQL with is a pure Python MySQL module – apparently, it’s slower than using a C library, but it doesn’t have dependencies and just works. I had many issues getting MySQLdb or the fork, MySQL client to work on either Windows or Mac. For the size of my database, I’m not too worried about the speed of the implementation, particularly given that the main bottleneck will be the web scraping anyway.
Originally used the built-in Python HTML scraping library, but quickly changed to using Beautifulsoup. It is much more flexible and easier to write.

Of course, I actually got much further in the project as you can read about in the earlier posts, and also I probably shouldn’t let blogs like this go too long I suppose. It’s much easier to blog about the successes rather than the issues. If you have any ideas to make this easier… please let me know 🙂

Posted by Anthony in Course Chooser

UQ Course Chooser Stage 2 – Database Planning and Evolution.

This is the second post in a series, documenting the progression of the project and the challenges I faced at each stage. I’m intending these posts to be almost reflective in nature, rather than very technical, though I will lightly justify some technical choices also. Once I feel that I can move the project out of a prototype stage, I’ll put up a more formal page documenting the technology and some overall reflections.

Following on from part one, I have a Python script to scrape UQ’s course and program websites and now need to design and build a database to store the scraped data.

Continue reading →

Posted by Anthony in Course Chooser