File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ Exceptions and warnings
2929 errors.AttributeConflictWarning
3030 errors.ClosedFileError
3131 errors.CSSWarning
32+ errors.DatabaseError
3233 errors.DataError
3334 errors.DtypeWarning
3435 errors.DuplicateLabelError
Original file line number Diff line number Diff line change @@ -456,12 +456,26 @@ class AttributeConflictWarning(Warning):
456456 """
457457
458458
459+ class DatabaseError (OSError ):
460+ """
461+ Error is raised when executing sql with bad syntax or sql that throws an error.
462+
463+ Examples
464+ --------
465+ >>> from sqlite3 import connect
466+ >>> conn = connect(':memory:')
467+ >>> pd.read_sql('select * test', conn) # doctest: +SKIP
468+ ... # DatabaseError: Execution failed on sql 'test': near "test": syntax error
469+ """
470+
471+
459472__all__ = [
460473 "AbstractMethodError" ,
461474 "AccessorRegistrationWarning" ,
462475 "AttributeConflictWarning" ,
463476 "ClosedFileError" ,
464477 "CSSWarning" ,
478+ "DatabaseError" ,
465479 "DataError" ,
466480 "DtypeWarning" ,
467481 "DuplicateLabelError" ,
Original file line number Diff line number Diff line change 3131 DtypeArg ,
3232)
3333from pandas .compat ._optional import import_optional_dependency
34- from pandas .errors import AbstractMethodError
34+ from pandas .errors import (
35+ AbstractMethodError ,
36+ DatabaseError ,
37+ )
3538from pandas .util ._exceptions import find_stack_level
3639
3740from pandas .core .dtypes .common import (
5659 from sqlalchemy import Table
5760
5861
59- class DatabaseError (OSError ):
60- pass
61-
62-
6362# -----------------------------------------------------------------------------
6463# -- Helper functions
6564
Original file line number Diff line number Diff line change 3434 "PossibleDataLossError" ,
3535 "IncompatibilityWarning" ,
3636 "AttributeConflictWarning" ,
37+ "DatabaseError" ,
3738 ],
3839)
3940def test_exception_importable (exc ):
You can’t perform that action at this time.
0 commit comments