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

Update requirements.txt for SqlAlchemy #60

Closed
wants to merge 1 commit into from

Conversation

kazyakj
Copy link

@kazyakj kazyakj commented Feb 24, 2023

Related to Issue 41
With the release of SqlAlchemy2 the sqlalchemy.orm.mapper() was removed completely. This causes the cosmicpython-redis_pubsub-1 and cosmicpython-api-1 containers to fail.

Traceback (most recent call last):
  File "/src/allocation/entrypoints/redis_eventconsumer.py", line 31, in <module>
    main()
  File "/src/allocation/entrypoints/redis_eventconsumer.py", line 15, in main
    bus = bootstrap.bootstrap()
  File "/src/allocation/bootstrap.py", line 22, in bootstrap
    orm.start_mappers()
  File "/src/allocation/adapters/orm.py", line 65, in start_mappers
    lines_mapper = mapper(model.OrderLine, order_lines)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/_orm_constructors.py", line 1880, in _mapper_fn
    raise InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: The 'sqlalchemy.orm.mapper()' function is removed as of SQLAlchemy 2.0.  

Use the 'sqlalchemy.orm.registry.map_imperatively()` method of the ``sqlalchemy.orm.registry`` class to perform classical mapping.

Not sure what the status of PR 44 is but as a quick fix simply specifying an explicit SqlAlchemy version in the requirements.txt allows the containers to build successfully without requiring any code changes.


sqlalchemy -> sqlalchemy~=1.4.46 

Copy link

@ljak ljak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validating the version.

@hjwp
Copy link
Contributor

hjwp commented May 12, 2023

hey i think i already hacked in a fix for this with sqlalchemy<2

must get round to upgrading someday!

thanks in any case, hope you've enjoyed the book!

@hjwp hjwp closed this May 12, 2023
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 this pull request may close these issues.

3 participants