Here are the examples of the python api sqlalchemy.exc.args taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : test_except.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_tostring_large_executemany(self):
try:
raise sa_exceptions.DBAPIError.instance(
"this is a message",
[
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
],
OperationalError("sql error"),
DatabaseError,
)
except sa_exceptions.DBAPIError as exc:
eq_(
str(exc),
"(test.base.test_except.OperationalError) sql error\n"
"[SQL: this is a message]\n"
"[parameters: [{1: 1}, {1: 1}, {1: 1}, {1: 1}, {1: 1},"
" {1: 1}, {1: 1}, {1: 1}, {1: 1}, {1: 1}]]\n"
"(Background on this error at: http://sqlalche.me/e/e3q8)",
)
eq_(
exc.args,
("(test.base.test_except.OperationalError) sql error",),
)
try:
raise sa_exceptions.DBAPIError.instance(
"this is a message",
[
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
{1: 1},
],
OperationalError(),
DatabaseError,
ismulti=True,
)
except sa_exceptions.DBAPIError as exc:
eq_(
str(exc),
"(test.base.test_except.OperationalError) \n"
"[SQL: this is a message]\n"
"[parameters: [{1: 1}, "
"{1: 1}, {1: 1}, {1: 1}, {1: 1}, {1: 1}, "
"{1: 1}, {1: 1} ... displaying 10 of 11 total "
"bound parameter sets ... {1: 1}, {1: 1}]]\n"
"(Background on this error at: http://sqlalche.me/e/e3q8)",
)
try:
raise sa_exceptions.DBAPIError.instance(
"this is a message",
[(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,)],
OperationalError(),
DatabaseError,
)
except sa_exceptions.DBAPIError as exc:
eq_(
str(exc),
"(test.base.test_except.OperationalError) \n"
"[SQL: this is a message]\n"
"[parameters: [(1,), "
"(1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,)]]\n"
"(Background on this error at: http://sqlalche.me/e/e3q8)",
)
try:
raise sa_exceptions.DBAPIError.instance(
"this is a message",
[
(1,),
(1,),
(1,),
(1,),
(1,),
(1,),
(1,),
(1,),
(1,),
(1,),
(1,),
],
OperationalError(),
DatabaseError,
ismulti=True,
)
except sa_exceptions.DBAPIError as exc:
eq_(
str(exc),
"(test.base.test_except.OperationalError) \n"
"[SQL: this is a message]\n"
"[parameters: [(1,), "
"(1,), (1,), (1,), (1,), (1,), (1,), (1,) "
"... displaying 10 of 11 total bound "
"parameter sets ... (1,), (1,)]]\n"
"(Background on this error at: http://sqlalche.me/e/e3q8)",
)