SAP / sqlalchemy-hana

SQLAlchemy Dialect for SAP HANA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Excessive warning because of wrong value of supports_statement_cache

0anton opened this issue · comments

HANA dialect provider does not support statement caching, but not explicitly disable it, so the default caching supported is taken.

This causes excessive warnings like that in the application:

/usr/local/lib/python3.10/site-packages/upganalib/db/sql_lib.py:88: SAWarning: Dialect hana:hdbcli 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)

We are forced to "intervene" into the library and disable it locally in the application to suppress warnings:

from sqlalchemy_hana.dialect import HANAHDBCLIDialect

HANAHDBCLIDialect.supports_statement_cache = False

Could you please do it directly the library or support statement caching?

Our internal reference https://github.tools.sap/upgrade-analytics/upganalib/issues/57

commented

@0anton thanks for reporting this. We'll add it to the 1.0.0 TODO list