pkundurthy/uwpyKepler — comment on commit b75d844436793910cf41461671fa5f4bb5c04fff
File:  line 0
By pkundurthy:

ah, I see what the problem is. You are opening and closing the connection to the db for every KID in your list, this will slow things down.

do something like this

```python

def countCadence(KIDlist):

dBhost = 'tddb.astro.washington.edu'
dBuser = 'tddb'
dBpass = 'tddb'
dBname = 'KeplerNew'
cursor = kep.iodb.dbConnect(dBhost,dBuser,dBpass,dBname)

LCList = []
SCList = []
LCSCList = []

for KID in KIDlist:
foo0 = 'select KEPLERID from source where (KEPLERID = %s and LCFLAG = 0) LIMIT 1' % (KeplerID)
foo1 = 'select KEPLERID from source where (KEPLERID = %s and LCFLAG = 1) LIMIT 1' % (KeplerID)
cursor.execute(foo0)
results0 = cursor.fetchall()