https://dagster.io/ logo
#ask-community
Title
# ask-community
d

Drew You

08/07/2023, 2:57 PM
I'm getting this error when I attempt to view an asset in the dagit front end. and I'm also getting it when I attempt to query the gql endpoint directly.
Copy code
Operation name: AssetEventsQuery

Message: (psycopg2.errors.QueryCanceled) canceling statement due to statement timeout

[SQL: SELECT event_logs.id, event_logs.event 
FROM event_logs 
WHERE event_logs.dagster_event_type = %(dagster_event_type_1)s AND event_logs.asset_key = %(asset_key_1)s AND event_logs.partition IN (%(partition_1_1)s) ORDER BY event_logs.id DESC]
[parameters: {'dagster_event_type_1': 'ASSET_MATERIALIZATION', 'asset_key_1': '["haruko", "fund_perp_positions"]', 'partition_1_1': 'Flagship Fund'}]
(Background on this error at: <https://sqlalche.me/e/20/e3q8>)

Path: ["assetOrError","assetMaterializations"]

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

Stack Trace:
  File "/usr/local/lib/python3.11/site-packages/graphql/execution/execute.py", line 521, in execute_field
    result = resolve_fn(source, info, **args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dagster_graphql/schema/pipelines/pipeline.py", line 232, in resolve_assetMaterializations
    events = get_asset_materializations(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dagster_graphql/implementation/fetch_assets.py", line 256, in get_asset_materializations
    event_records = instance.get_event_records(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dagster/_utils/__init__.py", line 649, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dagster/_core/instance/__init__.py", line 1779, in get_event_records
    return self._event_storage.get_event_records(event_records_filter, limit, ascending)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dagster/_core/storage/event_log/sql_event_log.py", line 952, in get_event_records
    results = conn.execute(query).fetchall()
              ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1412, in execute
    return meth(
           ^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2339, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
    cursor.execute(statement, parameters)

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

Message: psycopg2.errors.QueryCanceled: canceling statement due to statement timeout



Stack Trace:
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
    cursor.execute(statement, parameters)
a

alex

08/10/2023, 6:30 PM
for the previous post containing your custom query, you will likely need to specify a
limit
on
assetMaterializations
to prevent trying to fetch all of them. The
AssetEventsQuery
used in the product specifies a
limit
, unless you happen to be on an older version that does not
4 Views