Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:36:05+00:00 2026-06-14T08:36:05+00:00

I am having the problem OperationalError: (1054, Unknown column ‘Ellie’ in ‘field list’) With

  • 0

I am having the problem
OperationalError: (1054, “Unknown column ‘Ellie’ in ‘field list'”)
With the code below, I’m trying to insert data from json into a my sql database. The problem happens whenever I try to insert a string in this case “Ellie” This is something do to with string interpolation I think but I cant get it to work despite trying some other solutions I have seen here..

CREATE TABLE

con = MySQLdb.connect('localhost','root','','tweetsdb01')
cursor = con.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS User(user_id BIGINT NOT NULL PRIMARY KEY, username varchar(25) NOT NULL,user varchar(25) NOT NULL) CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB")
con.commit() 

INSERT INTO

def populate_user(a,b,c):
    con = MySQLdb.connect('localhost','root','','tweetsdb01')
    cursor = con.cursor()
    cursor.execute("INSERT INTO User(user_id,username,user) VALUES(%s,%s,%s)"%(a,b,c))
    con.commit() 
    cursor.close() 

READ FILE- this calls the populate method above

def read(file):
    json_data=open(file)
    tweets = []
    for i in range(10):
        tweet = json.loads(json_data.readline())

    populate_user(tweet['from_user_id'],tweet['from_user_name'],tweet['from_user'])
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:36:06+00:00Added an answer on June 14, 2026 at 8:36 am

    Use parametrized SQL:

    cursor.execute("INSERT INTO User(user_id,username,user) VALUES (%s,%s,%s)", (a,b,c))
    

    (Notice the values (a,b,c) are passed to the function execute as a second argument, not as part of the first argument through string interpolation). MySQLdb will properly quote the arguments for you.


    PS. As Vajk Hermecz notes, the problem occurs because the string 'Ellie' is not being properly quoted.

    When you do the string interpolation with "(%s,)" % (a,) you get
    (Ellie,) whereas what you really want is ('Ellie',). But don’t bother doing the quoting yourself. It is safer and easier to use parametrized SQL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problem with datagrid view. I have attached an image with the code
I am having problem with drawing multiple lines during repaint. The code is as
I'am having problem in accessing json array elements. Below is the response when i
Having problem with this bit of code qith jQuery. it should pick the values
i having problem in converting this C# code into VB.net. The loadLecturer seem to
hey there i am having problem i have List<List<memoryCard>> that i want to show
I am having problem with the XCode->Project->Edit Active Target projectname setting I am trying
I am having problem with the title of a header in my jquery code.
I am having problem with implementing custom session handler in php. The code: http://pastebin.com/9QV9f22Q
Im having problem trying to join 3 tables, every time I run the query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.