Tortoise-orm: ValueError: cannot specify both default and default_factory

Created on 8 Mar 2021  路  13Comments  路  Source: tortoise/tortoise-orm

Hello. I am attempting to deploy a fastapi/tortoiseorm application to Digital Ocean App platform using docker and i am receiving that error. Any ideas how to go about fixing it?

This line seems to throw the error:

User_Pydantic = pydantic_model_creator(TortoiseUser, name="User")

Thanks.

Most helpful comment

All 13 comments

I don't have a solution, but I remember having the same issue if an UUID field was used as primary key.

I am using UUID actually.

Sure. How am i supposed to apply that?

Just install from latest dev branch, or wait next release

How do i do that via requirements.txt? Or when will the next release be?

So how would that look for this library on the dev branch?

I have applied the patch by installing from the latest dev branch
pip install git+https://github.com/tortoise/tortoise-orm

tortoise-orm == 0.17.0

That solved the error but please notice that you get a dependency error for aerich in my requirements.txt
aerich == 0.5.0
pydantic == 1.8.1

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aerich 0.5.0 requires tortoise-orm<0.17.0,>=0.16.21, but you have tortoise-orm 0.17.0 which is incompatible.

@athanhat

You have to specify the branch name.

git+git://github.com/tortoise/tortoise-orm.git@develop#egg=tortoise-orm

Although your issue might be different than what i am inferring from your comment.

Thanks, you cannot avoid the dependency resolver ERROR if aerich Tortoise-ORM migrations tool is installed. So they have to fix that too in the next release. But this error is harmless, aerich commands in my case are executed successfully. @rossedwardsus for the moment I think it's OK to use aerich 0.5.0
Install this first, then tortoise 0.17.0

I just added aerich but i have not done a push and had to have the dependencies installed again.

So what is your solution? To not use aerich and uninstall it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mheppner picture mheppner  路  4Comments

pjongy picture pjongy  路  4Comments

M-e-r-c-u-r-y picture M-e-r-c-u-r-y  路  3Comments

je111ena picture je111ena  路  7Comments

usernein picture usernein  路  4Comments