AttributeError("module 'sqlalchemy' has no attribute 'dialects'"

1,595 views
Skip to first unread message

Evgenii

unread,
Apr 7, 2022, 6:17:48 AM4/7/22
to sqlalchemy

Hello!
Thank you for the previous answer.

I use prefect and dask to execute workflows, that use SA inside and I get
very strange errors periodically:

Task 'HE Quotes[5]': Exception encountered during task execution!
Traceback (most recent call last):
File "/home/prefect_env/lib/python3.7/site-packages/prefect/engine/task_runner.py", line 880, in get_task_run_state
logger=self.logger,
File "/home/prefect_env/lib/python3.7/site-packages/prefect/utilities/executors.py", line 499, in run_task_with_timeout
name=f"Task '{name}'",
File "/home/prefect_env/lib/python3.7/site-packages/prefect/utilities/executors.py", line 417, in run_with_multiprocess_timeout
raise result
File "/home/prefect_env/lib/python3.7/site-packages/prefect/utilities/executors.py", line 300, in multiprocessing_safe_run_and_retrieve
return_val = fn(*args, **kwargs)
File "/home/prefect_env/lib/python3.7/site-packages/prefect_flows/flows/proc/HE1.py", line 42, in transform_data_task
rd_ids = transform_data(HE_params, pref_connection_path, config_connection_path, minio_keys, logger)
File "/home/prefect_env/lib/python3.7/site-packages/prefect_flows/tasks/proc/he.py", line 141, in transform_data
client.run(trim_memory)
File "/home/prefect_env/lib/python3.7/site-packages/distributed/client.py", line 2472, in run
return self.sync(self._run, function, *args, **kwargs)
File "/home/prefect_env/lib/python3.7/site-packages/distributed/utils.py", line 311, in sync
self.loop, func, *args, callback_timeout=callback_timeout, **kwargs
File "/home/prefect_env/lib/python3.7/site-packages/distributed/utils.py", line 364, in sync
raise exc.with_traceback(tb)
File "/home/prefect_env/lib/python3.7/site-packages/distributed/utils.py", line 349, in f
result[0] = yield future
File "/home/prefect_env/lib/python3.7/site-packages/tornado/gen.py", line 762, in run
value = future.result()
File "/home/prefect_env/lib/python3.7/site-packages/distributed/client.py", line 2401, in _run
nanny=nanny,
File "/home/prefect_env/lib/python3.7/site-packages/distributed/core.py", line 886, in send_recv_from_rpc
result = await send_recv(comm=comm, op=key, **kwargs)
File "/home/prefect_env/lib/python3.7/site-packages/distributed/core.py", line 679, in send_recv
raise exc.with_traceback(tb)
File "/srv/data/test_distr_calc/dask-env/lib/python3.7/site-packages/distributed/core.py", line 521, in handle_comm
File "/srv/data/test_distr_calc/dask-env/lib/python3.7/site-packages/distributed/scheduler.py", line 6021, in broadcast
File "/srv/data/test_distr_calc/dask-env/lib/python3.7/site-packages/distributed/utils.py", line 208, in All
File "/srv/data/test_distr_calc/dask-env/lib/python3.7/site-packages/distributed/scheduler.py", line 6015, in send_message
File "/srv/data/test_distr_calc/dask-env/lib/python3.7/site-packages/distributed/core.py", line 681, in send_recv
Exception: AttributeError("module 'sqlalchemy' has no attribute 'dialects'")

The only similar problem I found is: https://stackoverflow.com/questions/61304397/attributeerror-module-sqlalchemy-dialects-has-no-attribute-postgresql
The main issue of that is you should not name modules with built-in names. Therefore:

  • I checked, I don’t have any script named sqlalchemy.py
  • Don’t have any stupid imports like import not_sa_module as sqlalchemy
  • sqlalchemy is installed from pypi and has attribute dialects

Do you have any ideas to solve this?

Mike Bayer

unread,
Apr 7, 2022, 8:50:01 AM4/7/22
to noreply-spamdigest via sqlalchemy
i dont know i would need to see the calling code
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages