File tree 4 files changed +20
-5
lines changed
4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ Exceptions and warnings
29
29
errors.AttributeConflictWarning
30
30
errors.ClosedFileError
31
31
errors.CSSWarning
32
+ errors.DatabaseError
32
33
errors.DataError
33
34
errors.DtypeWarning
34
35
errors.DuplicateLabelError
Original file line number Diff line number Diff line change @@ -456,12 +456,26 @@ class AttributeConflictWarning(Warning):
456
456
"""
457
457
458
458
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
+
459
472
__all__ = [
460
473
"AbstractMethodError" ,
461
474
"AccessorRegistrationWarning" ,
462
475
"AttributeConflictWarning" ,
463
476
"ClosedFileError" ,
464
477
"CSSWarning" ,
478
+ "DatabaseError" ,
465
479
"DataError" ,
466
480
"DtypeWarning" ,
467
481
"DuplicateLabelError" ,
Original file line number Diff line number Diff line change 31
31
DtypeArg ,
32
32
)
33
33
from pandas .compat ._optional import import_optional_dependency
34
- from pandas .errors import AbstractMethodError
34
+ from pandas .errors import (
35
+ AbstractMethodError ,
36
+ DatabaseError ,
37
+ )
35
38
from pandas .util ._exceptions import find_stack_level
36
39
37
40
from pandas .core .dtypes .common import (
56
59
from sqlalchemy import Table
57
60
58
61
59
- class DatabaseError (OSError ):
60
- pass
61
-
62
-
63
62
# -----------------------------------------------------------------------------
64
63
# -- Helper functions
65
64
Original file line number Diff line number Diff line change 34
34
"PossibleDataLossError" ,
35
35
"IncompatibilityWarning" ,
36
36
"AttributeConflictWarning" ,
37
+ "DatabaseError" ,
37
38
],
38
39
)
39
40
def test_exception_importable (exc ):
You can’t perform that action at this time.
0 commit comments