473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reduced invective

My fat-fingered alter ego typed
delete from iv where date '2006-01-01';
instead of
delete from iv where date '2006-12-01';
leaving me with 50 tables to reload. :(

estimated time to fix several hours
estimated invective dispensed during fix = classified

Python to the rescue!

import os
import MySQLdb

files = os.listdir("d:\\hedge\\old data\\")

conn = MySQLdb.connect(host = 'host',
user = 'user',
passwd = 'pass',
db = 'db')
curs = conn.cursor()

for line in files:
if line[-4:] == "2006":
SQL = "LOAD DATA "
SQL += "INFILE 'd:/hedge/old data/" + line
SQL += "' INTO TABLE iv "
SQL += "FIELDS TERMINATED BY ',' "
SQL += "(symbol, date, iv, pv, cv);"
curs.execute(SQL)

time to execute = 5 mins
invective dispensed while executing = 0

A hearty thank you and Happy Holidays to all in the Python community.

jab

Dec 19 '06 #1
0 751

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Philipp | last post by:
Hello I'm working on a piece of code which I did not write and it has variables defined as: unsigned short i:13; unsigned short j:13; unsigned short k:3; As I understand the code, this...
4
by: Bob Richardson | last post by:
Is it possible for an image to SHRINK (both height and width, keeping same h/w ratio) when the browser's width is reduced? It's easy to have both h & w increase, as needed, to fill up 100% of the...
0
by: Gail E. Harris | last post by:
OOPSLA 2005 is being held in San Diego, Oct 16 to 20. Invited speakers include: Robert Hass, Martin Fowler, Gerald Jay Sussman Grady Booch, Jimmy Wales, Mary Beth Rosson, David P. Reed The...
5
by: Thierry | last post by:
Hello, I'd like to write a function who return a float with only two digits after the point. For instance : 12.34567 -> 12.34 Any help would be welcome Tkx, Titi.
1
by: Jeff S | last post by:
I'm trying to optimize performance of a few pages. Toward this result, I have done the following: 1. set EnableViewState="false" and EnableSessionState="false" in the @ Page directive. 2. set...
5
by: jayapal | last post by:
Hi all, We have large code on which we are solving the bugs. For every bug we change the code part either add or delete some of the code part. More is adding the code part and very less is...
2
by: abhi86 | last post by:
Hi All, In my html page in which i have used <div>'s horizontal scroll is not coming when window size is reduced. And its taking all divisions starting from left as i justified them. but if...
4
by: remya1000 | last post by:
i'm using VB.Net Application program. i'm creating 64 button dynamically during run time. and from database i'm getting the description, font color, back color and picture path. and if the picture...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.