standardize async dbapi exceptions with access pattern

This issue has been created since 2022-05-23.

Discussed in #8023

I think we should try to hit this in terms of all the async dialects all of which have to do what we are doing here, which would be that we make a common mixin / base for all the async-adapted DBAPIs. for asyncpg it would be used here:

class Error(Exception):
pass

    from ..exc import EmulatedDBAPIException

    class Error(EmulatedDBAPIException):
        pass

that way people can look at EmulatedDBAPIException to see the fields, which would be like:

class EmulatedDBAPIException:
    """an exception class used to adapt non-DBAPI database driver exceptions
    into DBAPI exceptions"""

    message: str
    """string message indicating the error"""

    orig: Exception
    """the original driver-level exception object"""

that looks kind of boring so we can also add an accessor on

class DBAPIError(StatementError):
called "driver_exception". This would work similarly to how we have "dbapi_connection" / "driver_connection" on Connection.

that way someone that knows asyncpg can receive the top level SQLAlchemy DBAPIException and just refer to .driver_exception to get all the asyncpg fields.

CaselIT wrote this answer on 2022-05-23

makes sense. this would also work for sync driver, only "dbapi_expection" / "driver_exception" would point to the same object

zzzeek wrote this answer on 2022-08-03

if someone wants to work on this sooner, it can be 2.0, but for now not an urgent need here

More Details About Repo
Owner Name sqlalchemy
Repo Name sqlalchemy
Full Name sqlalchemy/sqlalchemy
Language Python
Created Date 2018-11-27
Updated Date 2022-09-28
Star Count 6037
Watcher Count 93
Fork Count 975
Issue Count 159

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Error showing page in project with prism 0 2021-03-17 2022-07-23
Annotations and Panel Errors 2 2022-02-02 2022-07-31
[question] how to capture query response into a variable? 3 2021-05-31 2022-09-25
Incorrect Table Output from Computational Table 0 2022-07-20 2022-08-30
Quarto not finding a variable used in a capton 3 2022-07-18 2022-09-02
Attach tour on lazy loading elements like modals 3 2021-01-19 2022-09-02
[android] Light/Dark theme icon 0 2021-11-15 2022-07-20
How to store the intermediate results of the pipeline 3 2022-09-20 2022-09-20
intermediate value error 4 2021-09-02 2022-07-01
Suggestion for structuring dreampkgs 2 2021-11-12 2022-07-03
将全家桶GNU工具链(分支)纳入到CI中 0 2021-09-23 2022-09-24
将全家桶QEMU分支纳入到CI中 0 2021-09-23 2021-12-29
引入 buildbot 并尝试进行 CI Job 的复制 1 2021-09-23 2022-09-28
给V8的CI加上交叉编译构建和QEMU测试、Unmatched 测试 0 2021-09-23 2022-07-29
Docking bug with nested main windows 5 2021-09-12 2022-08-21
please add Iraq (+986) 0 2021-09-01 2022-08-19
Create always skipped 7 2021-02-13 2022-09-17
In Razor editor pressing Shift Enter after method declaration should insert { } as it does in .cs editor. 2 2022-05-12 2022-09-22
Asking for help with error: nrniv: CoreNEURON cannot simulate a model that contains the extracellular mechanism 3 2022-02-01 2022-09-11
Magiclysm weapons missing weapon flags 2 2022-02-27 2022-08-01
After accepting takeback both players left waiting for opponent to move 2 2021-09-26 2022-09-19
Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized. 1 2021-01-12 2022-09-28
Allow faster way to load events from many different sources 3 2021-11-16 2022-09-26
Problem with RAW in actual Version 10 2020-06-13 2022-08-19
[BUG] make build 4 2020-12-28 2022-01-16
Test against ctypes 0.18.0 3 2020-11-12 2022-09-25
harmonize Environment variable 0 2021-08-03 2022-08-17
[Bug]: Choosing different dropdown options on mutlitree select widget does not reflect changes on actual dropdown 0 2022-07-11 2022-07-11
[Bug]: Signing up as a new user from a public app does not work 1 2022-07-11 2022-07-11
Grouping and Reorganisation for Audio Widget 0 2022-07-11 2022-09-04
Relay: get-started: cannot follow initial howto 4 2022-08-15 2022-09-07
Creating newrelic_cloud_azure_link_account Fails during Apply 3 2022-03-17 2022-09-09
Join a conversation using the invite link, using the app, without being logged on a nextcloud server 1 2021-10-16 2022-09-02
transformer-js: script in isolated HTML page is not run 0 2022-06-01 2022-09-19
bug: home.sessionPath is broken with ZSH 13 2022-05-31 2022-09-11
BitBucket Trigger Node no longer working with the new API changes 2 2021-09-21 2022-09-21
Apostrophe and accent letters cannot be used in Live Search queries 12 2022-08-16 2022-09-19
Expose Spec `ServerContainer.upgrade()` API 0 2021-10-06 2022-09-14
Remove the "last updated" counter 0 2021-08-20 2022-07-01
Suspicious transitivity of relaxed CAS 3 2021-12-12 2022-09-18
[Monitor - Opentelemetry Exporter] Test OpenTelemetry Versions - Monitor failing in nightly runs 2 2022-06-10 2022-09-20
Layered Deployment 10 2021-02-23 2022-01-20
Plugin not published even though there was a confirmation email 1 2021-08-20 2022-09-24
[BUG] Marlin doesn't work on LERDGE-K on Marlin 2.0.9.3 and up. Display doesn't work on LERDGE-K on Marlin 2.0.8.2-2.0.9.2 36 2022-06-14 2022-09-27
Filter out closed AdSense accounts based on new API capabilities 10 2022-04-07 2022-09-24
Non-idempotent output with chained function calls and tab-width 2 or less 3 2022-03-31 2022-08-27
request help: When will it be possible to support specific ports for single route monitoring? 2 2021-09-28 2022-09-14
CSV downloads can result in shifted column values 2 2022-07-21 2022-09-23
Lose hot overload after using JSX 1 2021-05-14 2022-09-28
Could not create service of type ExecutionHistoryStore using DependencyManagementGradleUserHomeScopeServices.createExecutionHistoryStore(). 3 2019-07-25 2022-09-14