DB Output to a list – What am I doing wrong? /u/GrumpyHubby Python Education

I know this is basic stuff but I can’t seem to figure it out right now. I have a DB query that returns 2600 rows. No matter what I try, I can only get the last row in my list. Someone please point out where I’m goofing up at. And I know that I can use pandas. I’m just not too much a fan of it right now.

for row in oracleConnect(config.sql): myAppID = row[0] myRespID = row[1] myRespName = row[2] myDesc = row[3] myStartDate = row[4] myDataOwner = row[5] mySecDataOwner = row[6] myResults = myResults + str([row[0], row[1], row[2], row[3], row[4], row[5], row[6]]) myRow = [ ['Application ID', 'Responsibility ID', 'Responsibility Name', 'Description', 'StartDate', 'Data Owner', 'Data Owner 2'], myResults ] 

submitted by /u/GrumpyHubby
[link] [comments]

​r/learnpython I know this is basic stuff but I can’t seem to figure it out right now. I have a DB query that returns 2600 rows. No matter what I try, I can only get the last row in my list. Someone please point out where I’m goofing up at. And I know that I can use pandas. I’m just not too much a fan of it right now. for row in oracleConnect(config.sql): myAppID = row[0] myRespID = row[1] myRespName = row[2] myDesc = row[3] myStartDate = row[4] myDataOwner = row[5] mySecDataOwner = row[6] myResults = myResults + str([row[0], row[1], row[2], row[3], row[4], row[5], row[6]]) myRow = [ [‘Application ID’, ‘Responsibility ID’, ‘Responsibility Name’, ‘Description’, ‘StartDate’, ‘Data Owner’, ‘Data Owner 2’], myResults ] submitted by /u/GrumpyHubby [link] [comments] 

I know this is basic stuff but I can’t seem to figure it out right now. I have a DB query that returns 2600 rows. No matter what I try, I can only get the last row in my list. Someone please point out where I’m goofing up at. And I know that I can use pandas. I’m just not too much a fan of it right now.

for row in oracleConnect(config.sql): myAppID = row[0] myRespID = row[1] myRespName = row[2] myDesc = row[3] myStartDate = row[4] myDataOwner = row[5] mySecDataOwner = row[6] myResults = myResults + str([row[0], row[1], row[2], row[3], row[4], row[5], row[6]]) myRow = [ ['Application ID', 'Responsibility ID', 'Responsibility Name', 'Description', 'StartDate', 'Data Owner', 'Data Owner 2'], myResults ] 

submitted by /u/GrumpyHubby
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *