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
Uh oh!
There was an error while loading. Please reload this page.
-
Given the default schema example:
This will create a
bandtable with amanagercolumn and amanagerproperty.Is it possible to get a
manager_idin 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