Skip to content

Commit

Permalink
Patch supports_statement_cache warning. (#259)
Browse files Browse the repository at this point in the history
* patch fixing SQLAlchemy 'supports_statement_cache' warning. SQLAlchemy implementation looks into the class dictionary which is why the warning is still present even though flag is set on the Mixin base classes. The value is properly set into the base classes now.

* Update CHANGES.rst

Co-authored-by: Brooke White <Brooke-white@users.noreply.github.com>
  • Loading branch information
gmcrocetti and Brooke-white committed Dec 8, 2022
1 parent e2f033f commit d4f8fb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
@@ -1,7 +1,7 @@
0.8.12 (unreleased)
-------------------

- Nothing changed yet.
- Fix SQLAlchemy's "supports_statement_cache" (`Pull #259 <https://github.com/sqlalchemy-redshift/sqlalchemy-redshift/pull/259>`_)


0.8.11 (2022-07-27)
Expand Down
7 changes: 2 additions & 5 deletions sqlalchemy_redshift/dialect.py
Expand Up @@ -558,9 +558,6 @@ class RedshiftDialectMixin(DefaultDialect):

name = 'redshift'
max_identifier_length = 127
# explicitly disables statement cache to disable warnings in logs
# ref: https://docs.sqlalchemy.org/en/14/core/connections.html#caching-for-third-party-dialects # noqa
supports_statement_cache = False

statement_compiler = RedshiftCompiler
ddl_compiler = RedshiftDDLCompiler
Expand Down Expand Up @@ -1036,7 +1033,7 @@ def dbapi(cls):
class RedshiftDialect_psycopg2(
Psycopg2RedshiftDialectMixin, PGDialect_psycopg2
):
pass
supports_statement_cache = False


# Add RedshiftDialect synonym for backwards compatibility.
Expand All @@ -1046,7 +1043,7 @@ class RedshiftDialect_psycopg2(
class RedshiftDialect_psycopg2cffi(
Psycopg2RedshiftDialectMixin, PGDialect_psycopg2cffi
):
pass
supports_statement_cache = False


class RedshiftDialect_redshift_connector(RedshiftDialectMixin, PGDialect):
Expand Down

0 comments on commit d4f8fb6

Please sign in to comment.