Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gmr/queries
1 result
Show changes
Commits on Source (3)
Version History
===============
- Next Release
- 1.10.4 2018-01-10
- Implement ``Results.__bool__`` to be explicit about Python 3 support.
- Catch any exception raised when using TornadoSession and invoking the execute function in psycopg2 for exceptions raised prior to sending the query to Postgres.
This could be psycopg2.Error, IndexError, KeyError, or who knows, it's not documented in psycopg2.
- 1.10.3 2017-11-01
- Remove the functionality from ``TornadoSession.validate`` and make it raise a ``DeprecationWarning``
- Catch the ``KeyError`` raised when ``PoolManager.clean()`` is invoked for a pool that doesn't exist
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ The core `queries.Queries` class will automatically register support for UUIDs,
Unicode and Unicode arrays.
 
"""
__version__ = '1.10.3'
__version__ = '1.10.4'
version = __version__
 
import logging
Loading
Loading
Loading
Loading
@@ -392,7 +392,10 @@ class TornadoSession(session.Session):
 
# Get the cursor, execute the query
func = getattr(cursor, method)
func(query, parameters)
try:
func(query, parameters)
except Exception as error:
future.set_exception(error)
 
# Ensure the pool exists for the connection
self._ensure_pool_exists()
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ classifiers = ['Development Status :: 5 - Production/Stable',
'Topic :: Software Development :: Libraries']
 
setup(name='queries',
version='1.10.3',
version='1.10.4',
description="Simplified PostgreSQL client built upon Psycopg2",
maintainer="Gavin M. Roy",
maintainer_email="gavinmroy@gmail.com",
Loading
Loading
Loading
Loading
@@ -207,7 +207,7 @@ class SessionPublicMethodTests(testing.AsyncTestCase):
future.set_result(True)
_execute.return_value = future
obj = tornado_session.TornadoSession(io_loop=self.io_loop)
result = yield obj.callproc('foo', ['bar'])
yield obj.callproc('foo', ['bar'])
_execute.assert_called_once_with('callproc', 'foo', ['bar'])
 
@testing.gen_test
Loading
Loading
@@ -218,5 +218,17 @@ class SessionPublicMethodTests(testing.AsyncTestCase):
future.set_result(True)
_execute.return_value = future
obj = tornado_session.TornadoSession(io_loop=self.io_loop)
result = yield obj.query('SELECT 1')
yield obj.query('SELECT 1')
_execute.assert_called_once_with('execute', 'SELECT 1', None)
@testing.gen_test
def test_query_error_key_error(self):
obj = tornado_session.TornadoSession(io_loop=self.io_loop)
with self.assertRaises(Exception):
yield obj.query('SELECT * FROM foo WHERE bar=%(baz)s', {})
@testing.gen_test
def test_query_error_index_error(self):
obj = tornado_session.TornadoSession(io_loop=self.io_loop)
with self.assertRaises(Exception):
yield obj.query('SELECT * FROM foo WHERE bar=%s', [])