sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column dashboards.tags does not exist
LINE 1: ...ived, dashboards.is_draft AS dashboards_is_draft, dashboards...
^
[SQL: 'SELECT dashboards.updated_at AS dashboards_updated_at, dashboards.created_at AS dashboards_created_at, dashboards.id AS dashboards_id, dashboards.version AS dashboards_version, dashboards.org_id AS dashboards_org_id, dashboards.slug AS dashboards_slug, dashboards.name AS dashboards_name, dashboards.user_id AS dashboards_user_id, dashboards.layout AS dashboards_layout, dashboards.dashboard_filters_enabled AS dashboards_dashboard_filters_enabled, dashboards.is_archived AS dashboards_is_archived, dashboards.is_draft AS dashboards_is_draft, dashboards.tags AS dashboards_tags \nFROM dashboards'] (Background on this error at: http://sqlalche.me/e/f405)
the table does not contain dashboards.tags column at all

This happens because the migration code uses the dashboard model code (redash.models.Dashboard) which assumes some new column exists (that gets created in another migration). I don’t think I’ll have the time to fix this migration You can manually alter it not use redash.models.Dashboard but rather do the update using SQL.

You can see an example in the way we update tags in dashboards in another migration.

and these migrations are still left to do
0f740a081d20_inline_tags.py Change migration to be safe to run along with other migrations
65fc9ede4746_add_is_draft_status_to_queries_and_.py Modernize Python 2 code to get ready for Python 3
71477dadd6ef_favorites_unique_constraint.py Handle duplicate favorite calls.

I feel like I am not very proficient on sqlalchemy/alembic. I can try a bit more. Is there some example of using SQL queries directly that I can use? I was looking at models.py, which have some db.session.query(), but db seems to be a instance of flask_sqlalchemy.SQLAlchemy, can we do that in migrations?