Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
these are my models
class Name1(models.Model):
    userid = models.IntegerField(primary_key=True)
    username = models.CharField(max_length=300)

class Meaning3(models.Model):
    userid = models.IntegerField(primary_key=True)
    meaning = models.CharField(max_length=300)


class output1(models.Model):
    userid = models.IntegerField(max_length=300)
    username = models.CharField(max_length=300)
    meaning = models.CharField(max_length=300)


and i tried to join name1 and meaning3 table with simple join but i have the error like integrity error of datatype mismatch..

what's wrong with ma code

What I have tried:

cursor.execute('INSERT INTO music_meaning3(userid,meaning) values(NULL,?)', rand_item)
        cursor.execute(''' INSERT INTO music_output1 SELECT username, meaning,NULL FROM music_name1 N JOIN music_meaning3 T ON N.userid = T.userid''')
        db.commit()
Posted
Updated 24-Aug-18 3:11am

1 solution

The same problem as described in your previous question: https://www.codeproject.com/Questions/1257519/Data-type-mismatch-error-on-django-sqlite3[^]. And Solution 1 there has already given you the answer: you cannot have a primary key without a value. And you also appear to have two tables using the same item as primary key.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900