From 9fc54801c8235a6327e0ce80b145f7ba756ae47a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 31 Oct 2019 09:30:12 -0400 Subject: Cache every key in reflection_cache Fixed bug in :class:`.Inspector` where the cache key generation did not take into account arguments passed in the form of tuples, such as the tuple of view name styles to return for the PostgreSQL dialect. This would lead the inspector to cache too generally for a more specific set of criteria. The logic has been adjusted to include every keyword element in the cache, as every argument is expected to be appropriate for a cache else the caching decorator should be bypassed by the dialect. Fixes: #4955 Change-Id: Icd97744323407977a3f7db26e8a63a1a5c576010 --- test/dialect/postgresql/test_reflection.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/dialect/postgresql/test_reflection.py') diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py index 7054a9fdd..b6cedd55f 100644 --- a/test/dialect/postgresql/test_reflection.py +++ b/test/dialect/postgresql/test_reflection.py @@ -232,6 +232,17 @@ class MaterializedViewReflectionTest( set(["test_mview"]), ) + def test_get_view_names_reflection_cache_ok(self): + insp = inspect(testing.db) + eq_( + set(insp.get_view_names(include=("plain",))), set(["test_regview"]) + ) + eq_( + set(insp.get_view_names(include=("materialized",))), + set(["test_mview"]), + ) + eq_(set(insp.get_view_names()), set(["test_regview", "test_mview"])) + def test_get_view_names_empty(self): insp = inspect(testing.db) assert_raises(ValueError, insp.get_view_names, include=()) -- cgit v1.2.1