[BangPypers] Query | Automating report through Python

Noufal Ibrahim noufal at nibrahim.net.in
Tue Jun 4 10:49:12 CEST 2013

Fagun Bhavsar <fagun.bhavsar at gmail.com> writes:

> Hi,
> I have couple of reports that need to be sent during end of the
> day. There's single DB table, from which data is being picked and put
> into xcel-like tabular format and sent to specific email address.
> I want to understand - by using python, how to go about for automating
> this task? What are the key points to be considered here? This is just
> for learning purpose, hence I am looking forward to similar examples,
> if someone can guide me.

It seems quite straightforward. Connect to the db, run your query,
convert the response into a csv or tsv (there is a csv module in the
standard libary) file and then email (there's an smtp module in the
stdlib too) it. It'd look the same in most scripting languages.

What exactly are you looking for? 



More information about the BangPypers mailing list