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

SQL compilation caching #16

Open
erik-abrahamsson opened this issue Jun 10, 2022 · 6 comments
Open

SQL compilation caching #16

erik-abrahamsson opened this issue Jun 10, 2022 · 6 comments

Comments

@erik-abrahamsson
Copy link

erik-abrahamsson commented Jun 10, 2022

Hi, I get this warning message. I'm not sure if this would be an easy fix or not but it would be nice to have this caching enabled.
I also don't understand how to set the attribute to False like suggested to get rid of the warning.

c:\dev\LEproj\backend\.venv\lib\site-packages\sqlalchemy_sqlany\base.py:464: SAWarning: Dialect sqlany:<module 'sqlanydb' from 'c:\\dev\\LEproj\\backend\\.venv\\lib\\site-packages\\sqlanydb.py'> will not make use of SQL compilation caching as it does not set the 'supports_statement_cache' attribute to ``True``. This can have significant performance implications including some performance degradations in comparison to prior SQLAlchemy versions. Dialect maintainers should seek to set this attribute to True after appropriate development and testing for SQLAlchemy 1.4 caching support. Alternatively, this attribute may be set to False which will disable this warning. (Background on this error at: https://sqlalche.me/e/14/cprf)

This might be helpful: https://docs.sqlalchemy.org/en/14/core/internals.html#sqlalchemy.engine.Dialect.supports_statement_cache

@jamesrusso
Copy link

At a minimum should define this to be false to prevent the warning.

@jamesrusso
Copy link

I have a PR up to resolve the warning, but not add the caching.

#17

@erik-abrahamsson
Copy link
Author

Hi, is there any chance this could be merged soon?

@jamesrusso
Copy link

I bumped version which they were asking for in PR. Should be ready to merge now.

@erik-abrahamsson
Copy link
Author

I looked at this again and found that this works to disable the warning. I thought earlier that it could be fixed in the package only.

from sqlalchemy_sqlany.base import SQLAnyDialect
SQLAnyDialect.supports_statement_cache = False

@jamesrusso
Copy link

Good to know, thanks!

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

No branches or pull requests

2 participants