Link to home
Start Free TrialLog in
Avatar of fosiul01
fosiul01Flag for United Kingdom of Great Britain and Northern Ireland

asked on

unable to pass argument to mysql query (python)

def Add_Daemon_Record_only(domain_name,domain_id):

 sql_insert_daemon_record = """select test_master_dns_record.domain_id, \
    test_master_dns_record.record_name,test_master_dns_record.type,test_master_dns_record.ttl,\
    test_master_dns_record.data,test_master_dns_record.gtdlocation \
     from test_master_dns_record where test_master_dns_record.data like '78%' \
     and  test_master_dns_record.domain_id = %s """ %(domain_id)
     
   
    cursor.execute(sql_insert_daemon_record)


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.domain_id = %s """ %(domain_id)
ValueError: unsupported format character ''' (0x27) at index 278

can any one please give me the right syntax ??
ASKER CERTIFIED SOLUTION
Avatar of pepr
pepr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fosiul01

ASKER

thanks great
thats works..