489 Commits

Author SHA1 Message Date
Oleksii Chuprykov
686005e35e Added check to see whether oslotest is installed
The projects that are using oslo.db in tests need to explicitly
include oslotest in their test-requirements.

Closes-bug: 1356425

Change-Id: I0ed01e141221d19af5593857c13a656f32d0f3cf
2014-08-20 18:35:10 +03:00
Jenkins
68c0b62972 Merge "Implement a dialect-level function dispatch system" 2014-08-20 00:47:37 +00:00
Jenkins
ec05831e3d Merge "Handle DB2 SmallInteger type for change_deleted_column_type_to_boolean" 2014-08-18 19:42:17 +00:00
Mike Bayer
ee176a82a4 Implement a dialect-level function dispatch system
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
2014-08-12 17:07:32 -04:00
Jenkins
e2adc4384a Merge "Move to oslo.utils" 2014-08-11 18:38:08 +00:00
Andrey Kurilin
6065b21b15 Move to oslo.utils
`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
2014-08-11 17:33:52 +03:00
Mike Bayer
deeda38447 Restore correct source file encodings
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
2014-08-07 19:45:19 -04:00
Jenkins
036c9b4eef Merge "Fixed DeprecationWarning in exc_filters" 2014-08-06 14:45:17 +00:00
Matt Riedemann
4dde38bbb8 Handle DB2 SmallInteger type for change_deleted_column_type_to_boolean
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
2014-08-05 07:11:03 -07:00
OpenStack Proposal Bot
4c18fca18e Imported Translations from Transifex
Change-Id: Idbb2bbdd071ff54e8c250ffbd32273c41aeb0b39
2014-08-05 06:03:24 +00:00
Petr Blaho
69f16bf8b1 Fixes comments to pass E265 check.
Fixes comments to pass E265 check.
Removes E265 from ignore setting in tox.ini.

Change-Id: I2e83c037a920a06b24695d6daea70ded179e3ebe
2014-08-03 17:19:06 +02:00
Petr Blaho
e1dbd31c5b Fixes indentations to pass E128 check.
Fixes indentations to pass E128 check.
Removes E128 from ignore setting in tox.ini.

Change-Id: I92ca574c076b4bd26e424a3b404188601264b5de
2014-08-03 17:19:06 +02:00
Petr Blaho
423c17e02b Uses keyword params for i18n string to pass H703
Uses keyword params for i18n string to pass H703 check.
Removes H703 from ignore setting in tox.ini.

Change-Id: I7b4f48be739167aed7dcb33a8a70e24adfe02672
2014-08-03 17:19:00 +02:00
Petr Blaho
3cb592775d Adds empty line to multilines docs to pass H405
Adds empty line to multilines docs to pass H405 check.
Removes H405 from ignore setting in tox.ini.

Change-Id: I0516fb12765bf961a4488570a6c73b80f667d972
2014-08-03 17:08:21 +02:00
Petr Blaho
0996c5d016 Updates one line docstring with dot to pass H402
Updates one line docstring with dot to pass H402.
Removes H402 from ignore setting in tox.ini.

Change-Id: Ibb4f16cbb3bb453456b579e0fafbd3f4c4e60aff
2014-08-03 16:38:22 +02:00
Petr Blaho
a3ca010d0a Changes import orders to pass H305 check
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
2014-08-03 16:38:22 +02:00
Alexei Kornienko
584a883488 Fixed DeprecationWarning in exc_filters
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
2014-08-01 14:02:14 +00:00
OpenStack Proposal Bot
fc2fc90eb0 Imported Translations from Transifex
Change-Id: I19f5da636bd8ef643c213d5dc27ebd804aba318e
2014-07-31 06:03:27 +00:00
Ilya Pekelny
3b1736516d oslo.db.exceptions module documentation
Change-Id: Ie4a56a043215bc893e54f5d8b03bb28cb824548f
2014-07-30 17:52:13 +03:00
Jenkins
3f6b009570 Merge "remove definitions of Python Source Code Encoding" 2014-07-30 14:05:17 +00:00
Jenkins
ff32fdf93f Merge "Specify raise_on_warnings=False for mysqlconnector" 2014-07-29 09:35:50 +00:00
Jenkins
d1ca4073dd Merge "Updated from global requirements" 2014-07-29 09:20:54 +00:00
Jenkins
45a3a462b6 Merge "oslo.db.api module documentation" 2014-07-29 09:16:08 +00:00
OpenStack Proposal Bot
c919585ad4 Updated from global requirements
Change-Id: Id12176070ac675883a7ad90c8a46c494b592747e
2014-07-28 19:53:04 +00:00
Jenkins
db790f95b8 Merge "oslo.db.options module documentation" 2014-07-28 19:46:49 +00:00
Jenkins
09c44b1ed3 Merge "Extension of DBDuplicateEntry exception" 2014-07-28 13:49:46 +00:00
Jenkins
8f3be012f2 Merge "Imported Translations from Transifex" 2014-07-28 13:42:04 +00:00
Jenkins
a157ba5fb9 Merge "Remove sqla_07 from tox.ini" 2014-07-28 10:55:27 +00:00
Jenkins
26ba9dfadb Merge "Allow tox tests with complex OS_TEST_DBAPI_CONNECTION URLs" 2014-07-28 09:55:43 +00:00
pkholkin
4685631aba Extension of DBDuplicateEntry exception
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
2014-07-28 13:31:57 +04:00
Ilya Pekelny
7cb512c8bd oslo.db.options module documentation
Change-Id: I85d9b99a905108138e543ef5b08ea4a483352a18
2014-07-28 12:07:43 +03:00
Ilya Pekelny
c0d9f36756 oslo.db.api module documentation
Change-Id: Ibd94d9d8e7f2930f55401cf556a41e41198d4be1
2014-07-28 11:33:46 +03:00
OpenStack Proposal Bot
93d95d42df Imported Translations from Transifex
Change-Id: I4f7fa49a954d773b2f8784511cc9017ed9226e7c
2014-07-28 06:03:13 +00:00
Jenkins
8839e43b2a Merge "Bump hacking to version 0.9.2" 2014-07-25 14:42:49 +00:00
Jenkins
50b8d1e8a1 Merge "Raise DBReferenceError on foreign key violation" 2014-07-25 13:44:10 +00:00
Jenkins
8dbba33f00 Merge "Use SQLAlchemy cursor execute events for tracing" 2014-07-25 10:49:10 +00:00
Jenkins
20ccbf2bbf Merge "Port _is_db_connection_error check to exception filters" 2014-07-25 10:39:47 +00:00
Jenkins
bb03d7e1ce Merge "Integrate the ping listener into the filter system." 2014-07-25 10:28:59 +00:00
Jenkins
bbfe7e056f Merge "Updated from global requirements" 2014-07-25 10:26:05 +00:00
Jenkins
1e15033456 Merge "Add disconnect modification support to exception handling" 2014-07-25 10:24:29 +00:00
Mike Bayer
e83e4ca12d Use SQLAlchemy cursor execute events for tracing
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
2014-07-24 11:41:47 -04:00
Oleksii Chuprykov
d845a16abd Remove sqla_07 from tox.ini
Remove support of sqla_07 test according to global requirements

Change-Id: I1c4817c28b779bdb6467e346a38147b193f58a38
2014-07-24 12:31:28 +00:00
OpenStack Proposal Bot
9722ab61c1 Updated from global requirements
Change-Id: I4eed49a24f716b51093dbf52a3706cd0409ca6d9
2014-07-24 04:02:01 +00:00
Jenkins
548090f500 Merge "Add host argument to get_connect_string()" 2014-07-23 15:06:21 +00:00
Angus Lees
3bf8941cca Specify raise_on_warnings=False for mysqlconnector
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
2014-07-22 14:22:00 +10:00
Angus Lees
1814bf80cd Make MySQL regexes generic across MySQL drivers
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
2014-07-22 11:33:48 +10:00
Angus Lees
62729fb352 Allow tox tests with complex OS_TEST_DBAPI_CONNECTION URLs
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
2014-07-22 11:10:08 +10:00
Julien Danjou
a9e3af2ebf Raise DBReferenceError on foreign key violation
SQLAlchemy session code now parses foreign key violations and returns a
new custom exception so we can track them.

Change-Id: If5610b5743203a5c34ac7df240e5332c39911c4a
2014-07-21 16:56:02 +02:00
Vlad Okhrimenko
b69899e1ba Add host argument to get_connect_string()
'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
2014-07-21 13:25:21 +03:00
Jenkins
bf4eff9ffd Merge "Don't drop pre-existing database before tests" 2014-07-21 08:45:20 +00:00