完整性错误:数据类型不匹配 [英] Integrity error : datatype mismatch

查看:125
本文介绍了完整性错误:数据类型不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些是我的模型

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)





我试图通过简单的连接加入name1和meaning3表但是我有像数据类型不匹配的完整性错误这样的错误..



ma code有什么问题



我尝试过:





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()

推荐答案

与上一个问题中描述的问题相同: https:// www .codeproject.com / Questions / 1257519 / Data-type-mismatch-error-on-django-sqlite3 [ ^ ]。解决方案1已经给出了答案:没有值,你就不能拥有主键。并且您似乎还有两个表使用与主键相同的项目。
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.


这篇关于完整性错误:数据类型不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆