Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 必须指定连接条件,以获取此错误。_Python_Mysql_Orm_Mysql Python_Peewee - Fatal编程技术网

Python 必须指定连接条件,以获取此错误。

Python 必须指定连接条件,以获取此错误。,python,mysql,orm,mysql-python,peewee,Python,Mysql,Orm,Mysql Python,Peewee,我正在尝试联接两个表以查看其内容 Users.select().join(User_profiles).where(Users.users_id == User_profiles.users_id) 我的用户型号: class Users(Model): users_id = PrimaryKeyField() username = CharField() password = CharField() mobile_number = CharField()

我正在尝试联接两个表以查看其内容

Users.select().join(User_profiles).where(Users.users_id == User_profiles.users_id)
我的用户型号

class Users(Model):
    users_id = PrimaryKeyField()
    username = CharField()
    password = CharField()
    mobile_number = CharField()
    created_at = DateTimeField()
    updated_at = DateTimeField()

    class Meta:
        database = db_connection()
class User_profiles(Model):
    users_id = IntegerField()
    user_profiles_id = PrimaryKeyField()
    profile_name =  CharField()
    address = CharField()
    created_at = DateTimeField()
    updated_at = DateTimeField()    

    class Meta:
        database = db_connection()
我的用户配置文件模型

class Users(Model):
    users_id = PrimaryKeyField()
    username = CharField()
    password = CharField()
    mobile_number = CharField()
    created_at = DateTimeField()
    updated_at = DateTimeField()

    class Meta:
        database = db_connection()
class User_profiles(Model):
    users_id = IntegerField()
    user_profiles_id = PrimaryKeyField()
    profile_name =  CharField()
    address = CharField()
    created_at = DateTimeField()
    updated_at = DateTimeField()    

    class Meta:
        database = db_connection()

我已将“用户模型”中的“用户id”指定为“用户配置文件模型”的外键。如何以正确的方式指定连接条件?我读过peewee文档,做过谷歌搜索,但没有任何帮助。有人能帮我写代码吗?

我认为
用户配置文件\u id
应该写成
用户配置文件\u id=ForeignKeyField(用户)