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 7625601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:12:49+00:00 2026-05-31T05:12:49+00:00

From the beginning, I created the tables in my myapp folder and from the

  • 0

From the beginning, I created the tables in my myapp folder and from the shell ran

python manage.py sql myapp

which then produced the expected output
>

BEGIN;  
CREATE TABLE "myapp_dude" (  
    "id" integer NOT NULL PRIMARY KEY,  
    "name" varchar(128) NOT NULL  
)  
;  
CREATE TABLE "myapp_group_members" (  
    "id" integer NOT NULL PRIMARY KEY,  
    "group_id" integer NOT NULL,  
    "dude_id" integer NOT NULL REFERENCES "myapp_dude" ("id"),  
    UNIQUE ("group_id", "dude_id")  
)  
;  
CREATE TABLE "myapp_group" (  
    "id" integer NOT NULL PRIMARY KEY,  
    "name" varchar(128) NOT NULL  
)  
;  
CREATE TABLE "myapp_membership" (  
    "id" integer NOT NULL PRIMARY KEY,  
    "dude_id" integer NOT NULL REFERENCES "myapp_dude" ("id"),  
    "group_id" integer NOT NULL REFERENCES "myapp_group" ("id"),  
    "date_joined" date NOT NULL,  
    "invite_reason" varchar(64) NOT NULL  
)  
;  
COMMIT;  

I then synced the databases and began running the python shell. It accepts all arguments into my tables and adds the names/groups appropriately, even the membership works, however, when I try to simply save it, I get the following error.

>>> from myapp.models import Membership, Group, Dude  
>>> from datetime import date  
>>> ringo = Dude.objects.create(name="Ringo Starr")  
>>> paul = Dude.objects.create(name="Paul McCartney")  
>>> beatles = Group.objects.create(name="The Beatles")  
>>> m1 = Membership(dude=ringo, group=beatles,  
...     date_joined=date(1962, 8, 16),  
...     invite_reason="Needed a new drummer.")  
>>> m1.save()  
Traceback (most recent call last):  
  File "<console>", line 1, in <module>  
  File "C:\Python27\lib\site-packages\django\db\models\base.py", line 460, in sa  
ve  
    self.save_base(using=using, force_insert=force_insert, force_update=force_up  
date)  
  File "C:\Python27\lib\site-packages\django\db\models\base.py", line 553, in sa  
ve_base  
    result = manager._insert(values, return_id=update_pk, using=using)  
  File "C:\Python27\lib\site-packages\django\db\models\manager.py", line 195, in  
 _insert  
    return insert_query(self.model, values, **kwargs)  
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 1436, in  
insert_query  
    return query.get_compiler(using=using).execute_sql(return_id)  
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 79  
1, in execute_sql  
    cursor = super(SQLInsertCompiler, self).execute_sql(None)  
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 73  
5, in execute_sql  
    cursor.execute(sql, params)  
  File "C:\Python27\lib\site-packages\django\db\backends\util.py", line 34, in e  
xecute  
    return self.cursor.execute(sql, params)  
  File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line  
234, in execute  
    return Database.Cursor.execute(self, query, params)  
DatabaseError: table myapp_membership has no column named dude_id  

I am completely thrown for a loop with this because as you can see, when the tables are created, there IS a “dude_id” column created, but at the bottom of the error message, it says that it does not have one. And also the fact that I can add to dude, and add to the membership table fine but then cannot save doesn’t make much sense either. I have gone through this website, google, you name it but I have been unable to come up for a solution to this one.. Any insight will be much appreciated!!

  • 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-05-31T05:12:50+00:00Added an answer on May 31, 2026 at 5:12 am

    The error is pretty self explanatory. Your SQL schema differs from the one thas is defined in django. Try this

    python manage.py reset myapp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

with-open-file will read from the beginning of a file. If the file is VERY
The Perl FAQ entry How do I strip blank space from the beginning/end of
I'm working on a system than has to be pretty scalable from the beginning.
I'm relatively new to C++, and from the beginning it's been drilled into me
I want to remove the www. part from the beginning of an URL string
The code below removes www., etc. from the beginning of websites that are entered
I have recently started studying about threads. I thought of starting from the beginning
I am currently reading Beginning CakePHP:From Novice to Professional by David Golding. At one
I am trying to teach myself MySQL/PHP from the very beginning. The following code
I'm a newbie, and plainly started with a sample code from the book 'Beginning-iOS-5-Games-Development'.

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.