The projects that are using oslo.db in tests need to explicitly
include oslotest in their test-requirements.
Closes-bug: 1356425
Change-Id: I0ed01e141221d19af5593857c13a656f32d0f3cf
A new utility feature dispatch_for_dialect() is added, which
is intended to provide a single solution for the issue of many
areas within oslo.db where conditional per-database and/or
per-driver behavior is needed, such as that of setting up
special event listeners, connection options, or invoking
special features. The dispatch_for_dialect() function is
essentially a decorator, which when invoked provides subsequent
"builder" decorators in the style of the Python @property
object and others, so that any number of functions can be
registered against database/driver matcher strings. The system
supports "single" or "multiple" function call modes, wildcards
for both database and driver independently of each other,
support for URL strings, URL objects, Engine and Connection
objects as lead targets, and additional arguments and
return values for single mode.
The agenda of this feature is to provide the basis for the
removal of all remaining "if db.name == 'MYDB'" conditionals
throughout oslo.db and elsewhere.
Change-Id: I75201487c1481ffc83329a2eaaaa07acf5aac76e
`oslo.db` uses several modules(`importutils` and `timeutils`) from
`oslo-incubator`. This modules are already incubated and we should use them
from `oslo.utils`.
Change-Id: I09881ea3e115ca95bbd06ff5d1c0d5e253ed7640
migration.py includes a non-ASCII character in the top source
comments, so a "coding" directive is needed. Additionally,
the word "coding" is now used in test_sqlalchemy.py instead
of "encoding".
Change-Id: Ic977b564c5de9261686503506f4edec4a8d8682d
With the DB2 sqlalchemy driver (ibm_db_sa), boolean columns are stored
as SmallInteger rather than Boolean (or TINYINT for mysql). This change
updates the two tests that were changing the deleted column to boolean
and then checking the type based on the backing engine so they work for
ibm_db_sa.
Also changes the assertion from assertTrue to assertIsInstance since it
will provide a clearer failure message.
Closes-Bug: #1312423
Change-Id: I42975119ecacaac89e7225f57f9f6b52c455ab6a
Uses keyword params for i18n string to pass H703 check.
Removes H703 from ignore setting in tox.ini.
Change-Id: I7b4f48be739167aed7dcb33a8a70e24adfe02672
Adds empty line to multilines docs to pass H405 check.
Removes H405 from ignore setting in tox.ini.
Change-Id: I0516fb12765bf961a4488570a6c73b80f667d972
Changes import orders to H305 check in hacking 0.9.x
Leaves H305 in ignore setting in tox.ini
due to hacking is confused by oslo.* namespace
when checking import rules
see https://bugs.launchpad.net/hacking/+bug/1329363
Change-Id: I1701574b5e1a8cde1a044cda90a0c95360bb0825
DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
This warning was generated in exc_filters during exception conversions.
Fix it by removing access to deprecated attribute
Closes-Bug: #1257530
Change-Id: I8ff8b974946ecab13f12a70b315dd94c3453197e
Added new field 'value' for DBDuplicateEntry exception.
It shows duplicated value for mysql and postresql 9.x engines
and is read from the error message using regular expressions.
The duplicated value can't be extracted from SQLite error messages,
so we do our best here for other db backends that we support.
Change-Id: I647e314cafe8ceb570bf18948d6ab83ab6afef97
This change provides a consistent
system of intercepting statement executions, gaining information
about the current stack trace, and then injecting that information
either into the statement and/or logging it. The system
works for any backend without the need to code to DBAPI
details or monkeypatching of the cursor.
Change-Id: If80db9a0a898d2cb94837ff059fc054590050506
mysqlconnector driver in sqlalchemy <1.0 uses the wrong default value
for raise_on_warnings. With raise_on_warnings=True, many things we
expect to be warnings become fatal (like DROP DATABASE IF EXISTS
non_existent_db).
See https://bitbucket.org/zzzeek/sqlalchemy/issue/2515 for upstream bug.
Change-Id: Ic29c9bb6c692952640e3948f5ce31290e158068f
Note that mysqlconnector raises InternalError whereas mysqldb raises
OperationalError when a deadlock is found. The reported error codes and
messages are identical, however.
Change-Id: Iac9167e0777e0bf4361bcf6a8722923cce052b90
In particular, this allows OS_TEST_DBAPI_ADMIN_CONNECTION URLs with
alternate drivers like mysql+mysqlconnector://... to survive through
into OS_TEST_DBAPI_CONNECTION for the actual unittest.
Change-Id: I712d9366e616a551f4b2bd225de42469a35b363f
SQLAlchemy session code now parses foreign key violations and returns a
new custom exception so we can track them.
Change-Id: If5610b5743203a5c34ac7df240e5332c39911c4a
'localhost' value used to be hardcoded in get_connect_string().
Now it's possible to pass a custom host name as a function argument.
Wrote test for this
Change-Id: I3ae9f1a7df0bb378da1210cd89eef3e5f203cf34