Re: MySQL dymanic query in Python

2013-05-30 Thread RAHUL RAJ
On Wednesday, May 29, 2013 3:32:51 PM UTC+5:30, Fábio Santos wrote: > On 29 May 2013 10:13, "RAHUL RAJ" wrote: > > > > > > Can anyone tell me the proper way in which I can execute dynamic MySQL > > queries in Python? > > > > > > I want to do dynamic queries for both CREATE and INSERT statemen

Re: MySQL dymanic query in Python

2013-05-29 Thread Fábio Santos
On 29 May 2013 10:13, "RAHUL RAJ" wrote: > > Can anyone tell me the proper way in which I can execute dynamic MySQL queries in Python? > > I want to do dynamic queries for both CREATE and INSERT statement. > > Here is my attempted code: > > > sql="create table %s (%%s, %%s, %%s ... )" % (tablename

MySQL dymanic query in Python

2013-05-29 Thread RAHUL RAJ
Can anyone tell me the proper way in which I can execute dynamic MySQL queries in Python? I want to do dynamic queries for both CREATE and INSERT statement. Here is my attempted code: sql="create table %s (%%s, %%s, %%s ... )" % (tablename,''.join(fields)+' '.join(types)) cur.execute(sql)