Skip to content

Deprecation warning when using rest dialect with sqlalchemy #582

@aclemons

Description

@aclemons

Overview

I am using PyAthena 3.13.0 with sqlalchemy 2.0.40 and there is a deprecation warning regarding a missing class method on AthenaRestDialect:

sqlalchemy.exc.SADeprecationWarning: The dbapi() classmethod on dialect classes has been renamed to import_dbapi().  Implement an import_dbapi() classmethod directly on class <class 'pyathena.sqlalchemy.rest.AthenaRestDialect'> to remove this warning; the old .dbapi() classmethod may be maintained for backwards compatibility.

It looks like sqlalchemy requires the method on the parent to be directly on the class and not the parent:

https://github.com/laughingman7743/PyAthena/blob/d2806e4668ee9e718d35c22eee21a383edfc2e5a/pyathena/sqlalchemy/base.py#L1011-L1013

Here is the checking code in sqlalchemy:

https://github.com/sqlalchemy/sqlalchemy/blob/396c3fc70f36923c886e4fd45bc47f764cbd3245/lib/sqlalchemy/engine/create.py#L577-L602

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions