```Operation name: JobMetadataQuery Message: Inst...
# deployment-kubernetes
v
Copy code
Operation name: JobMetadataQuery

Message: Instance is out of date and must be migrated (Postgres run storage requires migration). Database is at revision 7cba9eeaaf1d, head is 7b8304b4429d. Please run `dagster instance migrate`.

Original exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask_sockets.py", line 41, in __call__
    environment = environ['wsgi.websocket']
KeyError: 'wsgi.websocket'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1772, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.WrongObjectType: WITHIN GROUP is required for ordered-set aggregate mode
LINE 3: WHERE runs.pipeline_name = 'dbt_pipeline' AND runs.mode = 'd...
                                                      ^


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/dagster/core/storage/sql.py", line 61, in handle_schema_errors
    yield
  File "/usr/local/lib/python3.7/site-packages/dagster_postgres/utils.py", line 166, in create_pg_connection
    yield conn
  File "/usr/local/lib/python3.7/site-packages/dagster/core/storage/runs/sql_run_storage.py", line 69, in fetchall
    result_proxy = conn.execute(query)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1263, in execute
    return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 324, in _execute_on_connection
    self, multiparams, params, execution_options
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1462, in _execute_clauseelement
    cache_hit=cache_hit,
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1815, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1996, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1772, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.WrongObjectType) WITHIN GROUP is required for ordered-set aggregate mode
LINE 3: WHERE runs.pipeline_name = 'dbt_pipeline' AND runs.mode = 'd...
                                                      ^

[SQL: SELECT runs.run_body 
FROM runs 
WHERE runs.pipeline_name = %(pipeline_name_1)s AND runs.mode = %(mode_1)s ORDER BY runs.id DESC 
 LIMIT %(param_1)s]
[parameters: {'pipeline_name_1': 'dbt_pipeline', 'mode_1': 'dev', 'param_1': 5}]
(Background on this error at: <https://sqlalche.me/e/14/f405>)


Path: ["pipelineRunsOrError","results"]

Locations: [{"line":21,"column":7}]

Stack Trace:
  File "/usr/local/lib/python3.7/site-packages/graphql/execution/executor.py", line 452, in resolve_or_error
    return executor.execute(resolve_fn, source, info, **args)
  File "/usr/local/lib/python3.7/site-packages/graphql/execution/executors/sync.py", line 16, in execute
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/dagster_graphql/schema/runs.py", line 91, in resolve_results
    return get_runs(graphene_info, self._filters, self._cursor, self._limit)
  File "/usr/local/lib/python3.7/site-packages/dagster_graphql/implementation/fetch_runs.py", line 104, in get_runs
    runs = instance.get_runs(filters, cursor, limit)
  File "/usr/local/lib/python3.7/site-packages/dagster/core/instance/__init__.py", line 984, in get_runs
    return self._run_storage.get_runs(filters, cursor, limit)
  File "/usr/local/lib/python3.7/site-packages/dagster/core/storage/runs/sql_run_storage.py", line 270, in get_runs
    rows = self.fetchall(query)
  File "/usr/local/lib/python3.7/site-packages/dagster/core/storage/runs/sql_run_storage.py", line 71, in fetchall
    result_proxy.close()
  File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/dagster_postgres/utils.py", line 166, in create_pg_connection
    yield conn
  File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/dagster/core/storage/sql.py", line 82, in handle_schema_errors
    ) from None