Skip to content Skip to sidebar Skip to footer

Sql Date Variables In Python

I am writing a query inside a Python script.The query is as follows: cur = conn.cursor() query1 = '''select max(date_time) from tablename''' cur.execute(queryy1) conn.commit() rows

Solution 1:

I tried this and now it worked

query2 ="""insert into table xyz(select * from abc where date_time = %s)"""
cur.execute(query2,(rows))

Though, I don't know why it worked and how is it different from what I was trying earlier

Post a Comment for "Sql Date Variables In Python"