Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 inserting data to mysql with python

Would anyone be able to help me out with the python code. I have been trying to write a code to read a value from .csv file and insert it into the mysql database. Unfortunately, I keep getting the error that syntax is incorrect.

This is the code I have written:
cur.execute("INSERT INTO Leashold_tb (leashold_or_not) VALUES (%(leashold_or_not,)s), ")

The error message I get is:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

I have been looking into many guides online, but I just can not find the correct way.

Would anyone be able to help me out here?

horrible with sql syntax myself but maybe have a look at this

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Mysql returning number of rows not data AkaAndrew123 4 520 Jun-10-2019, 02:31 PM
Last Post: AkaAndrew123
  Reading in MYSQL data as integer type Daveinthebigcity 2 337 May-13-2019, 11:30 AM
Last Post: Daveinthebigcity
  HELP! sending data to MySQL Slei 2 452 May-09-2019, 08:29 AM
Last Post: Slei
  Inserting a python list into a dataframe column wise mahmoud899 0 1,047 Mar-04-2019, 11:44 PM
Last Post: mahmoud899
  Issue while inserting data into Teradata via python dataframe sandy 2 932 Feb-10-2019, 08:06 PM
Last Post: sandy
  Storing MySQL BIT Data Type data in python variable krushna 2 631 Dec-31-2018, 01:28 AM
Last Post: krushna
  Python MySQL - How to pick column row data as variable? bharaths 1 568 Nov-02-2018, 12:08 PM
Last Post: bharaths
  Python 3.6, MySQL 8.0.12, SQLAlchemy 1.2.10, reflection la_khan 0 942 Sep-26-2018, 09:48 AM
Last Post: la_khan
  mysql db connection using python sunstar20 13 2,768 Aug-04-2018, 09:08 AM
Last Post: vishalhule
  Need help saving data into MySQL database reezalaq 0 630 Jun-03-2018, 07:50 PM
Last Post: reezalaq

Forum Jump:

Users browsing this thread: 1 Guest(s)