Christian Read
Christian Read

Reputation: 143

How to create table on MYSQL using Scrapy

Hi everyone I am trying to create table and add items on MYSQL but I always get this error

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near at line 6"

Can't track the specific problem any idea please? Here's my code

import mysql.connector

class GpdealsSpiderPipeline(object):

def __init__(self):
    self.create_connection()
    self.create_table()

def create_connection(self):
    self.conn = mysql.connector.connect(
        host = 'www.host1.com',
        user = 'userhost',
        password = 'samplepassword',
        database = 'databasesample'
    )
    self.curr = self.conn.cursor()

def create_table(self):
    self.curr.execute("""create table saleitems_hm(
                    hm_title text,
                    hm_regular_price text,
                    hm_sale_price text,
                    hm_photo_url text,
                    hm_description_url,
                    )""")

Please Help me Thank you

Upvotes: 0

Views: 131

Answers (1)

Arun Kumar
Arun Kumar

Reputation: 121

I think your create table query needs datatype

Upvotes: 1

Related Questions