All In One Script
MENU

Installing specific package versions with pip

by 5:48:00 AM
undefined
Installing specific package versions with pip I'm trying to install version 1.2.2 of the MySQL_python adaptor. The current version shown in PyPi is 1.2.3. Is there a way to install the older version? I found an article stating that this should do it: pip install MySQL_python==1.2.2 When installed, however, it still shows MySQL_python-1.2.3-py2.6.egg-info in the site packages. Is this a problem specific to this package, or am I doing something wrong? Answer: First, I see two issues with what you're trying to do. Since

SQL Select only rows with Max Value on a Column

by 5:45:00 AM
undefined
SQL Select only rows with Max Value on a Column I have this table for documents (simplified version here): +------+-------+--------------------------------------+ | id | rev | content | +------+-------+--------------------------------------+ | 1 | 1 | ... | | 2 | 1 | ... | | 1 | 2 | ... | | 1 | 3 | ... | +------+-------+--------------------------------------+ How do I select one row per id and only the greatest rev?With the above data, the result should contain two rows: [1, 3, ...] and [2, 1, ..].

How do I specify unique constraint for multiple columns in MySQL?

by 5:40:00 AM
undefined
How do I specify unique constraint for multiple columns in MySQL? I have a table: table votes ( id, user, email, address, primary key(id), ); Now I want to make the columns user, email, address unique (together). How do I do this in MySql? Of course the example is just... an example. So please don't worry about the semantics. Solution: ALTER TABLE `votes` ADD UNIQUE `unique_index`(`user`, `email`, `address`); http://stackoverflow.com/questions/635937/how-do-i-specify-unique-constraint-for-multiple-columns-in-mysql

“INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”

by 5:38:00 AM
undefined
“INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE” While executing an INSERT statement with many rows, I want to skip duplicate entries that would otherwise cause failure. After some research, my options appear to be the use of either: ON DUPLICATE KEY UPDATE which implies an unnecessary update at some cost, or INSERT IGNORE which implies an invitation for other kinds of failure to slip in unannounced. Am I right in these assumptions? What's the best way to simply skip the rows that might cause duplicates

Instagram