snt1017 commented on issue #20790: URL: https://github.com/apache/superset/issues/20790#issuecomment-1190346643
The error is solved by changing the method `get_joined_tables` in the file [38_a9422eeaae74_new_dataset_models_take_2.py](https://github.com/apache/superset/blob/master/superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py) at line 638 by next code: ```python def get_joined_tables(offset, limit): # Import aliased from sqlalchemy from sqlalchemy.orm import aliased # Create alias of NewColumn new_column_alias = aliased(NewColumn) # Get subquery and give it the alias "sl_colums_2" subquery = session.query(new_column_alias).offset(offset).limit(limit).subquery("sl_columns_2") return ( sa.join( subquery, dataset_column_association_table, # Use column id from subquery dataset_column_association_table.c.column_id == subquery.c.id, ) .join( NewDataset, NewDataset.id == dataset_column_association_table.c.dataset_id, ) .join( dataset_table_association_table, # Join tables with physical datasets and_( NewDataset.is_physical, dataset_table_association_table.c.dataset_id == NewDataset.id, ), isouter=True, ) .join(Database, Database.id == NewDataset.database_id) .join( TableColumn, # Use column uuid from subquery TableColumn.uuid == subquery.c.uuid, isouter=True, ) .join( SqlMetric, # Use column uuid from subquery SqlMetric.uuid == subquery.c.uuid, isouter=True, ) ) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org