diff options
| author | aryan <aryan@Aryans-MacBook-Pro.local> | 2020-03-03 16:07:11 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-03-04 12:26:31 +0100 |
| commit | 427a7e419b7d3f4d92094d67fcc29ecadd8332d3 (patch) | |
| tree | 38c2b52f2e92e90e462459591de4ecac09fef5b0 | |
| parent | 6dea42febaae82084c2ca5fef25b9e535e6bd794 (diff) | |
Fixed #31333 -- Added BaseDatabaseIntrospection.get_table_description().
| -rw-r--r-- | django/db/backends/base/introspection.py | 10 | ||||
| -rw-r--r-- | tests/backends/base/test_introspection.py | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/django/db/backends/base/introspection.py b/django/db/backends/base/introspection.py index 29807dfe98..d661e1fc0d 100644 --- a/django/db/backends/base/introspection.py +++ b/django/db/backends/base/introspection.py @@ -54,6 +54,16 @@ class BaseDatabaseIntrospection: """ raise NotImplementedError('subclasses of BaseDatabaseIntrospection may require a get_table_list() method') + def get_table_description(self, cursor, table_name): + """ + Return a description of the table with the DB-API cursor.description + interface. + """ + raise NotImplementedError( + 'subclasses of BaseDatabaseIntrospection may require a ' + 'get_table_description() method.' + ) + def get_migratable_models(self): from django.apps import apps from django.db import router diff --git a/tests/backends/base/test_introspection.py b/tests/backends/base/test_introspection.py index 2b8fbedd8e..5ad9c4f5e0 100644 --- a/tests/backends/base/test_introspection.py +++ b/tests/backends/base/test_introspection.py @@ -16,6 +16,11 @@ class SimpleDatabaseIntrospectionTests(SimpleTestCase): with self.assertRaisesMessage(NotImplementedError, msg): self.introspection.get_table_list(None) + def test_get_table_description(self): + msg = self.may_require_msg % 'get_table_description' + with self.assertRaisesMessage(NotImplementedError, msg): + self.introspection.get_table_description(None, None) + def test_get_sequences(self): msg = self.may_require_msg % 'get_sequences' with self.assertRaisesMessage(NotImplementedError, msg): |
