Categories
Uncategorized

Using Regex in MySQL

Very simple really That’s it.

Categories
Uncategorized

MySQL Node Matrix – Python

This will create either a directed or an undirected matrix on a MySQL data base. The edges are written as tuples, like this Where the first item in the tuple is the from node, the second item is the to node, and the third item is the weight of the edge. Here is the code […]

Categories
Uncategorized

Adding new entries to database – Python & MySQL

Checking to see if an entry exists in the database, if not, then add it Currently, in the database we only have two names, ‘Shaniqua’ and ‘Jose’ But the new list of names contains a new person ‘Latifah’. Here is how the db can be updated

Categories
Uncategorized

Selecting and Entering Values – MYSQL

This is how to enter a specific value in a column depending on the value of another column. So we have a table called ‘t_main’ in a database called ‘db_sample’, and it looks something like this. Name Stat1 Status Module 1 23 Module 2 50 Module 3 31 And we want to see if we […]

Categories
Uncategorized

Names to MySQL db – Python

I have a very long list of files that are named like this…. [manufacturer]_[device].txt So this small script will take the names and put them on a database.

Categories
Uncategorized

MySQL query in Python – Python

Just for my own reference. Install the mysql Module Connect and make query Very, very, very, very basic. More info: MySQL Python tutorial

Categories
Uncategorized

Getting MySQL and Python to work on Mac OS X Mountain Lion

Python comes pre-installed. So half the job is done there. Installing MySQL is pretty easy if you’re using Homebrew (which I am). You may have to do that as a super user….which means you have to add sudo to the start of the line. Next step is to get MySQL to talk to Python. For […]