I am trying to create a view in SqlAlchemy based on the following SQL Statement:
SELECT DISTINCT user_id, map_id FROM record;
In records there can be various user_id and map_id combinations. Also multiple entries of the same ids are possible.
I currently have the following code
class UserFinishedMaps(db.Model):
__table__ = create_view(
name="user_finished_maps",
selectable=select([Record.user_id, Record.map_id]).distinct(
Record.user_id, Record.map_id
),
metadata=db.metadata,
)
This obviously does not work. I am trying to figure out which the correct syntax for the selectable would be to matche the above SQL statement.