'error 1054 (42S22): Unknown column 'text' in 'field list' in my sql table

¨ im new to python and i have this program where i have to upload my json file data into my database table named tweet but i keep receiving the same error no matter what i do any help would be appreciated, thank you

please help me out

import mysql.connector
import json
# create the key

mydb = mysql.connector.connect(host='localhost', port='3306', user='root', password='nihad147', database='tweets')
mycursor = mydb.cursor()

sql_tweet = """INSERT INTO tweet (  tweet_id,
                                    name_screen, 
                                    tweet_location,
                                    latitude,
                                    longitude,
                                    created_at,
                                    text,
                                    id_user,
                                    categorie_name,
                                    )
                                    VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)"""

sql_user = """INSERT INTO tweetuser (
                                        id_user,
                                        name_screen,
                                        location_user,
                                        count_followers,
                                        friends_count,
                                        statuse_count) 
                                        VALUES (%s,%s,%s,%s,%s,%s)"""

myJsonFile = open("categorie3.json", encoding="utf-8", errors="ignore")


mycursor.execute("DELETE FROM tweet")
mycursor.execute("DELETE FROM tweetuser")

c = 0
for line in myJsonFile:
    c = c + 1
    print("tweet number ", c, " is uploading to the server")
    data = json.loads(line)
    # insert into tweet

    #print(data)

    val_tweet = (
        data['tweet_id'], data['user_screen_name'], data['location']['address']['city'],data['location']['lat'],data['location']['lon'], data['date'],data['raw_text'], data['user_id_str'],
       data['cat'])
    
    mycursor.execute(sql_tweet, val_tweet)

    mydb.commit()


print('done')

this is the error :

mysql.connector.errors.ProgrammingError: 1054 (42S22): Unknown column 'text' in 'field list'

and this is my database table :

create table tweet(
  tweet_id bigint not null primary key,
  name_screen varchar(40),
  tweet_location varchar(50),
  latitude float,
  longitude float,
  created_at varchar(70),
  test varchar(100),
  id_user bigint,
  categorie_name varchar(30));

i don't know if i made i mistake in my database table data type this a an example of my json file data:

    {"tweet_id": "1245877998005489664", "date": "Fri Apr 03 00:57:16 +0000 2020", "raw_text": "#كورونا — الولايات المتحدة... تسجيل 1169 وفاة جديدة بفيروس كورونا خلال 24 ساعة", "geo_source": {"amenity": "Constantine city hall", "road": "نهج 20 أغسطس", "neighbourhood": "al Madinat al Qadima", "suburb": "El Koudia", "village": "El Hattabia", "city": "Constantine", "county": "Constantine District", "state": "Constantine", "postcode": "25000", "country": "Algeria", "country_code": "dz"}, "location": {"address": {"country": "Algeria", "country_code": "dz", "city": "Constantine", "county": "Constantine District", "postcode": "25000", "state": "Constantine"}, "response": "{'place_id': 145056, 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'node', 'osm_id': 27564946, 'boundingbox': ['36.204519', '36.524519', '6.44826', '6.76826'], 'lat': '36.364519', 'lon': '6.60826', 'display_name': 'Constantine, Constantine District, Constantine, 25000, Algeria', 'class': 'place', 'type': 'city', 'importance': 0.57614635803195, 'icon': '/data/nominatimimages/mapicons/poi_place_city.p.20.png', 'address': {'city': 'Constantine', 'county': 'Constantine District', 'state': 'Constantine', 'postcode': '25000', 'country': 'Algeria', 'country_code': 'dz'}}", "geohash": "snkwy7gyxtev", "query_term": "constantine", "lon": 6.60826, "lat": 36.364519}, "user_friends_count": 143, "user_description": "|夜神 ライト|", "user_created_at": "Mon Apr 01 19:48:27 +0000 2019", "user_screen_name": "ArslenZr", "user_id_str": "1112803932647112706", "user_verified": false, "user_statuses_count": 1224, "user_followers_count": 103, "user_location": "Constantine                   ", "cat": "none"}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source