Reading CSV file in python

Python’s official Documentation says below thing about CSV files,

The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in RFC 4180.

Reading & Writing CSV files is very easy in Python. Below is a code snippet in python which can be used to read q csv file in python.

import csv

with open('filename.csv', 'r') as csv_file:
    reader = csv.reader(csv_file)
    for row in reader:

partial table dump using mysqldump

There are times when you only want to take partial dump of a mysql table. You can use mysqldump command with one extra option “–where”. You will have to provide your where clause (partial dump condition) in the “–” where option.

Below is the command to take a partial dump of a table.

mysqldump -u [username] -p  [databasename] [mytablename] --where  " mycolumn = 'somevalue' " > filename.sql

Related Posts:
1. MySQL dump in XML format.
2. MySQL general query logs.

Developer gets honest