Foreign Keys that reference non pk columns #393
Answered
by
dantownsend
theelderbeever
asked this question in
Q&A
-
Is it possible to create a foreign key on a table that references a column other than the primary key on a table? The documentation seems to imply that you can only pass a table to class Contract(BaseTable):
address = Varchar(index=True, required=True, null=False, unique=True)
class Log(BaseTable):
contract_address = ForeignKey(Contract.address) Is there a way to accomplish this? |
Beta Was this translation helpful? Give feedback.
Answered by
dantownsend
Jan 13, 2022
Replies: 1 comment 2 replies
-
@theelderbeever It's not currently possible with the version on PyPI. I've created a PR to add this functionality. It seems OK, but I need to test it a bit more before releasing it. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
theelderbeever
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@theelderbeever It's not currently possible with the version on PyPI.
I've created a PR to add this functionality. It seems OK, but I need to test it a bit more before releasing it.