Naming of foreign key columns #206
Unanswered
davidolrik
asked this question in
Q&A
Replies: 1 comment 1 reply
-
There's no API at the moment for mapping from Python attribute names to SQL column names. The names have to be the same. I like the idea you proposed: class Band(Table):
manager = ForeignKey(column_name="manager_id", references=Manager) It could be used for any column type too. It could be the column equivalent of specifying a custom tablename: class Band(Table, tablename="my_table"):
... I don't mind converting this into an issue, so it can be implemented at some point. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given the default schema example:
This will create a
band
table with amanager
column and amanager
property.Is it possible to get a
manager_id
in the database while still getting the "pretty" property name?If not, maybe something like this could be implemented:
Beta Was this translation helpful? Give feedback.
All reactions