이 쿼리를 내 데이터베이스에 게시하려고합니다. 문제는 placeholder가있는 csv에서 쿼리하는 것입니다. 얻을 수없는 것처럼 보입니다. Time_Date_Uploaded
varchar (255) DEFAULT NULL은 현재 시간으로 채워집니다. 여기 내 코드는 다음과 같습니다.파이썬 쿼리를 알아낼 수 없습니다.
cursor = mydb.cursor() # declare object
now = time.strftime('%Y-%m-%d %H:%M:%S') #want to send the current time to the database.
cr.next() # need to skip first line of csv
for row in cr:
cursor.execute('INSERT INTO loans2(LoanId, NoteId, OrderId, OutstandingPrincipal, AccruedInterest, Status, AskPrice, Markup_Discount, YTM, DaysSinceLastPayment, CreditScoreTrend, FICO_End_Range, Date_Time_Listed, NeverLate, Loan_Class, Loan_Maturity, Original_Note_Amount, Interest_Rate, Remaining_Payments, Principal_plus_Interest, Time_Date_Uploaded) VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")' % tuple(row))
# #close the connection to the database.
mydb.commit()
cursor.close()
print "Done"
thanks man! 완벽하게 작동합니다. Unfort는 upvote가 내가 15 평판 또는 무엇인가 필요하다고 말한다. – nematillo