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

Sa 2.0 #256

Closed
wants to merge 8 commits into from
Closed

Sa 2.0 #256

wants to merge 8 commits into from

Conversation

PedroAquilino
Copy link
Contributor

  • fixes #

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Ensure PR doesn't contain untouched code reformatting: spaces, etc.
  • Run flake8 and fix issues.
  • Run pytest no tests failed. See https://clickhouse-sqlalchemy.readthedocs.io/en/latest/development.html.

@coveralls
Copy link

Coverage Status

coverage: 85.542% (-0.2%) from 85.736% when pulling fc2f432 on usizy:sa-2.0 into 9545a17 on xzkostyan:master.

@Net-Mist
Copy link
Contributor

Hello,
thanks a lot for your work, we were looking to move to sqlalchemy 2 for a long time :)

I tested your code, and have a bug. When importing import clickhouse_sqlalchemy.types I get

ImportError: cannot import name '_bind_or_error' from 'sqlalchemy.sql.base' ([...]/python3.11/site-packages/sqlalchemy/sql/base.py)

Indeed, your code is still using _bind_or_error whereas it doesn't exist anymore in sqlalchemy 2. FYI, in v1.4, the function has a deprecated warning: "The bind argument for schema methods that invoke SQL against an engine or connection will be required in SQLAlchemy 2.0."

@PedroAquilino
Copy link
Contributor Author

Thanks @Net-Mist I check how to remove the reference to _bind_or_error

@Net-Mist
Copy link
Contributor

Hello !

I found another issue. In file clickhouse_sqlalchemy/ext/clauses.py, in the init of Lambda class, we need to replace util.callable to callable. Indeed sqlalchemy >= 2.0 doesn't provide this function anymore as it is now in python since 3.2

- Change util.callable with builtin callable
@PedroAquilino
Copy link
Contributor Author

I have changed the call to util.callable to the builtin callable

@m-alhajji
Copy link

Hi. Is there anything blocking this at the moment? Has people migrated to a different tool? Can I be of any help?

@xzkostyan
Copy link
Owner

Now tests are not green even after fixing lint errors: https://github.com/xzkostyan/clickhouse-sqlalchemy/actions/runs/6266313792/job/17017005243

@Net-Mist Net-Mist mentioned this pull request Oct 23, 2023
5 tasks
@xzkostyan
Copy link
Owner

Thank you. SQLAlchemy 2.0 support was released in 0.3.0.

@xzkostyan xzkostyan closed this Nov 5, 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.

Support for Sqlalchemy 2.0?
6 participants