Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource_id设置默认值以及唯一索引的原因导致写入失败 #23

Open
guoxiaod opened this issue Nov 16, 2020 · 0 comments
Open

Comments

@guoxiaod
Copy link

resource_id = Column('resource_id', String(50), unique=True, default="rg-{}".format(uuid()))

这块设置resource_id默认值后,实际上首次运行生成一个默认值,以后会一直使用这个默认值了,所有的默认值都是这个了。然后唯一索引会导致写入失败。
我们期望的是,每次写入的时候,类似update_time的默认值一样,重新运行uuid函数,但是实际不是。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant