fosiul01
asked on
unable to pass argument to mysql query (python)
def Add_Daemon_Record_only(dom ain_name,d omain_id):
sql_insert_daemon_record = """select test_master_dns_record.dom ain_id, \
test_master_dns_record.rec ord_name,t est_master _dns_recor d.type,tes t_master_d ns_record. ttl,\
test_master_dns_record.dat a,test_mas ter_dns_re cord.gtdlo cation \
from test_master_dns_record where test_master_dns_record.dat a like '78%' \
and test_master_dns_record.dom ain_id = %s """ %(domain_id)
cursor.execute(sql_insert_ daemon_rec ord)
the error i am getting is :
Traceback (most recent call last):
File "my_menu.py", line 582, in <module>
main()
File "my_menu.py", line 57, in main
Set_Round_Robin()
File "my_menu.py", line 332, in Set_Round_Robin
Add_Daemon_Record_only(row [2],row[0] )
File "my_menu.py", line 471, in Add_Daemon_Record_only
and test_master_dns_record.dom ain_id = %s """ %(domain_id)
ValueError: unsupported format character ''' (0x27) at index 278
can any one please give me the right syntax ??
sql_insert_daemon_record = """select test_master_dns_record.dom
test_master_dns_record.rec
test_master_dns_record.dat
from test_master_dns_record where test_master_dns_record.dat
and test_master_dns_record.dom
cursor.execute(sql_insert_
the error i am getting is :
Traceback (most recent call last):
File "my_menu.py", line 582, in <module>
main()
File "my_menu.py", line 57, in main
Set_Round_Robin()
File "my_menu.py", line 332, in Set_Round_Robin
Add_Daemon_Record_only(row
File "my_menu.py", line 471, in Add_Daemon_Record_only
and test_master_dns_record.dom
ValueError: unsupported format character ''' (0x27) at index 278
can any one please give me the right syntax ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thats works..