get_m2m and extra_column_values #1354
powellnorma
started this conversation in
Ideas
Replies: 2 comments
|
The best way to do this currently is to query the joining table. If we have this schema: class Band(Table):
name = Varchar()
genres = M2M(LazyTableReference("GenreToBand", module_path=__name__))
class Genre(Table):
name = Varchar()
bands = M2M(LazyTableReference("GenreToBand", module_path=__name__))
class GenreToBand(Table):
band = ForeignKey(Band)
genre = ForeignKey(Genre)
created_on = Timestamp() # an extra column on the joining tableWe can query it like this: >>> await GenreToBand.select(
... GenreToBand.created_on, # an extra column on the joining table
... GenreToBand.band.all_columns(),
... GenreToBand.genre.all_columns()
... )We might be able to modify |
0 replies
|
It would be great if this functionality appeared. |
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
After having inserted extra data to the joining table via the
extra_column_valuesargument toadd_m2m, how can I get those columns when usingget_m2m. If not currently possible, it would be great if this would be added in the future.All reactions