From http://docs.python.org/3.1/whatsnew/3.0.html:
"Python 3.0 uses the concepts of text and (binary) data instead of
Unicode strings and 8-bit strings."
Use six.text_type to Type for representing (Unicode) textual data. This
is unicode() in Python 2 and str in Python 3.
Change-Id: I3da268a714a34a8e626a2590f01b86e414dc3411
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Add some tests which for the regexp function which we install for
sqlite.
Need test coverage to catch e.g. a regression of the fix for
bug #1031846.
Change-Id: I4bd77d0d93c4fc85588e6e6d5a559e68133dbf73
Use range rather than xrange to improve python3
compatibiltiy.
Change-Id: I5a4434bbd2e5d509f84c3aa668eea8e46262816f
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Fixes bug 1171740
The method cleanup() can be called when a test is complete,
for example in the tearDown method.
Change-Id: Id30bcb0d7ef167f6cb3b1bdea06f6421e1234a86
Fixes bug 1171732
When creating an engine the called can indicate whether or
not to enforce the constraints for sqlite.
Change-Id: I1d5820376f60388c084afea500f807cd25541800
Created a 'TimestampMixin' class.
Next step is to update Nova which is the only project using oslo.db
Fixes bug #1119702
Change-Id: I1ffcc09a2971e6e6102da7ecb855a2837a159baf
sql_connection contains the password in some setups and marking as
secret prevents accidental logging
fixes bug 1160680
Change-Id: Ib2d00219ea40a010c62e6a29045309f030e6de28
Moves DB exceptions that can be shared between DB implementations into
their own module.
Adds DBDeadlock() exception wrapping. Nova has its own code for
determining Deadlock and it's better to consolidate it with
DBDuplicateKey checking.
Change-Id: I108bd0da2a14d62e460a997b1472f0b65bfc9b95
Fixes bug 1128605
The dbpool code in sqlalchemy session is the wrong place to implement
thread pooling as it wraps each individual SQL call to run in its own
thread. When combined with SQL server locking, all threads can be eaten
waiting on locks with none available to run a 'COMMIT'.
The correct place to do thread pooling is around each DB API call.
This patch removes dbpool from sqlalchemy and creates a common DB API
loader for all openstack projects which implements the following
configuration options:
db_backend: Full path to DB API backend module (or a known short name if
a project chooses to implement a mapping)
dbapi_use_tpool: True or False whether to use thread pooling around all
DB API calls.
DB backend modules must implement a 'get_backend()' method.
Example usage for nova/db/api.py would be:
"""
from nova.openstack.common.db import api as db_api
_KNOWN_BACKENDS = {'sqlalchemy': 'nova.db.sqlalchemy.api'}
IMPL = db_api.DBAPI(backend_mapping=_KNOWN_BACKENDS)
"""
NOTE: Enabling thread pooling will be broken until this issue is
resolved in eventlet _OR_ until we modify our eventlet.monkey_patch()
calls to include 'thread=False':
https://bitbucket.org/eventlet/eventlet/issue/137/
Change-Id: Idf14563ea07cf8ccf2a77b3f53659d8528927fc7
The cfg API is now available via the oslo-config library, so switch to
it and remove the copied-and-pasted version.
Add the 2013.1b3 tarball to tools/pip-requires - this will be changed
to 'oslo-config>=2013.1' when oslo-config is published to pypi. This
will happen in time for grizzly final.
Remove the 'deps = pep8==1.3.3' and 'deps = pyflakes' from tox.ini as
it means all the other deps get installed with easy_install which can't
install oslo-config from the URL.
Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
blueprint move-listener-framework-oslo
bug 1047015
bug 1111632
Ceilometer and Quantum use private methods of the RPC connection
object to configure themselves to listen to a queue shared among a
group of workers. This change adds a public method to the RPC
connection to support this use case, without resorting to using
private API calls.
Change-Id: I3a89f1dfdcf8accca70cf305f7a31315bea093d8
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
Fairly lame to do this instead of just fixing update.py, but we
seem to do it this way everywhere else, so ...
Change-Id: Ie1cebcfec57c6138b9b726d7d3bc6e0ea456f146
The use of the base exception does nothing for the test but means
the "dead module walking" exception module.
Change-Id: Ibd7bb8aa526be366f005ab5e12fd4da89a976c57
Since this only contains exceptions that are either used in session.py
or utils.py (not both), it seems sensible to move them into the modules
where they are used.
Also, remove the use of the Invalid base exception class since we don't
seem to be making use of the base class anywhere by catching it rather
than the more specialized exceptions.
Change-Id: Ib05bb2e0a9494e1dc60c60b8eee0e76b5d2ee555
Main issue is that we can't create unique constraint for columns, because
we are using soft deletion of entries (set `deleted` column to True).
The main idea is to use `deleted` columns to create unique constraint for
columns. For example (`col1`, `deleted`).
To make (`col1`, `deleted`) unique after entry deletion, we should assign the
value of `id` to `deleted` column.
Change type of `deleted` column from Boolean to table.id.type for all tables.
Change models.soft_delete() method to assign table.id instead of True to
`deleted` column.
Change query.soft_delete() method to assign literal_column("id") instead of True
blueprint db-unique-keys
Change-Id: Ie1f67f49a5d085e6371efb63fc23a1c8b25d9464
We should add wrap_db_error for Session.execute() method, because
Query.update() method will call Session.execute() and it is not inside
Session.flush(), so exceptions from Query.update() wouldn't be wrapped.
Add test for Session.flush() wrapper
Add test for Session.execute() wrapper
Fixes bug 1107890
Change-Id: I96894e502f9f279999b61a1e66469e34a07a022d
Eventlet versions >= 0.10 return a tuple from
db_pool.ConnectionPool().create(), not a scalar.
Also, set the FOUND_ROWS client flag, which sqlalchemy
appears to require to sanity check the number of rows
touch.
bug 1097992
Change-Id: I64e798660c506fcd13947a232cb7832db0318360
We probably only want to support people using set_defaults() for a
limited set of config options, so explicitly list those as parameters
to the method. This is what we do for rpc and log options too.
Change-Id: I3bfc5355e82eec17480b9547662e847dc0d74138
sql_dbpool_enable and sql_connection_trace are declared twice.
Looks like this was a merge conflict when sql_dbpool_enable changed
from int to bool.
Change-Id: I553c5beea916e0ee296648342324fd53167c073a
Looks like this was an abritrary cleanup done as part of the import. It
conflicts with a more recent change in Nova.
We can move to using try_import() once we've killed the Nova copy
of this code.
Change-Id: I5c67d3fbd846a262feb724e26b14447a76561ae6
Bring in session, base model, utilities, and tests for sqlalchemy
from Nova.
Add sqlalchemy to pip-requires and and python-mysql to test-requires.
Partially implements blueprint common-db
Change-Id: I3e0065cdac87e10c4e0742d66c293c72bb3acbb2
The earlier rename of openstack-common to oslo was incorrect; it should
have been oslo-incubator instead per the 2102-11-06 Project meeting log.
This change corrects its .gitreview file to match CI changes already
merged.
Change-Id: I9720387576a52654383bfc14f557ed1e06cc0a91
At the Design Summit it was decided that the OpenStack common modules
would be named Oslo as part of an effort to convert them into a core
project housing a collection of library dependencies. This handles the
necessary update to .gitreview reflecting the new remote name.
Change-Id: I350ff95213efe85579bc6fdce125237cb1f7f614
Ignore files created by packaging, builds, etc.
Change-Id: I9c1eed8c9791548b46e1532b345d80f3d84d4890
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>