If you have large production MySQL database that you wish to backup or replicate for testing, it is important to handle the export gently :)
For me, I use mysqldump. Remember that you must include several optional flags, which will speed up the export and most importantly avoid stressing your production MySQL.
mysqldump -u[username] -p[password] [database_name] --no-autocommit --quick --opt > dump.sql
–no-autocommit: Insert “SET AUTOCOMMIT=0;” and “COMMIT;” into the SQL dump. Enable speedier import later on.
–quick It retrieve a row at a time from MySQL instead of the entire rowset. It is very useful for dumping large databases.
–opt: This is enabled by default and it is a shorthand for –add-drop-table, –add-locks, –create-options, –disable-keys, –extended-insert, –lock-tables, –quick, and –set-charset.
An interesting trivial task is to concatenate two tuples in python.
Let’s say we try this out:
a = ('dd')
b = ('aa','bb')
Unfortunately likely we will get the following error:
Traceback (most recent call last):
File "test.py", line 20, in <module>
TypeError: cannot concatenate 'str' and 'tuple' objects
Read the rest of this entry »