Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'sqlalchemy.ext.declarative.api' #13

Open
ShadowKyogre opened this issue Dec 7, 2023 · 0 comments · May be fixed by #14
Open

ModuleNotFoundError: No module named 'sqlalchemy.ext.declarative.api' #13

ShadowKyogre opened this issue Dec 7, 2023 · 0 comments · May be fixed by #14

Comments

@ShadowKyogre
Copy link

ShadowKyogre commented Dec 7, 2023

The declarative API for SQL Alchemy got inlined with the base ORM manager for it as mentioned on this page.

https://docs.sqlalchemy.org/en/20/orm/extensions/declarative/api.html

https://docs.sqlalchemy.org/en/20/orm/mapping_api.html#sqlalchemy.orm.DeclarativeBase

Without fixing the code to adjust for it, I'm getting the following error when I try to set up ps_alchemy models for sacrud.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/shadowkyogre/code/personal/mimepo/mimepo/__main__.py", line 14, in <module>
    argh.dispatch_commands([main, initialize_db, scan_files])
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/argh/dispatching.py", line 328, in dispatch_commands
    dispatch(parser, *args, **kwargs)
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/argh/dispatching.py", line 174, in dispatch
    for line in lines:
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/argh/dispatching.py", line 277, in _execute_command
    for line in result:
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/argh/dispatching.py", line 260, in _call
    result = function(*positional, **keywords)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/mimepo/__init__.py", line 518, in main
    app = app_factory(cfg=cfg_file)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/mimepo/__init__.py", line 373, in app_factory
    config = config_factory(cfg=cfg)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/mimepo/__init__.py", line 368, in config_factory
    config.include('.')
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 666, in include
    c(configurator)
  File "/home/shadowkyogre/code/personal/mimepo/mimepo/__init__.py", line 324, in includeme
    config.include('ps_alchemy')
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 632, in include
    c = self.maybe_dotted(callable)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/pyramid/config/__init__.py", line 740, in maybe_dotted
    return self.name_resolver.maybe_resolve(dotted)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/pyramid/path.py", line 327, in maybe_resolve
    return self._resolve(dotted, package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/pyramid/path.py", line 334, in _resolve
    return self._zope_dottedname_style(dotted, package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/pyramid/path.py", line 383, in _zope_dottedname_style
    found = __import__(used)
            ^^^^^^^^^^^^^^^^
  File "/home/shadowkyogre/code/personal/mimepo/.venv/lib/python3.11/site-packages/ps_alchemy/__init__.py", line 10, in <module>
    from sqlalchemy.ext.declarative.api import DeclarativeMeta
ModuleNotFoundError: No module named 'sqlalchemy.ext.declarative.api'
@moorchegue moorchegue linked a pull request Mar 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant