mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Fixed #31345 -- Added BaseDatabaseIntrospection.get_relations().
This commit is contained in:
parent
17009e9105
commit
df4d622cac
@ -140,6 +140,17 @@ class BaseDatabaseIntrospection:
|
||||
"""
|
||||
raise NotImplementedError('subclasses of BaseDatabaseIntrospection may require a get_sequences() method')
|
||||
|
||||
def get_relations(self, cursor, table_name):
|
||||
"""
|
||||
Return a dictionary of
|
||||
{field_name: (field_name_other_table, other_table)} representing all
|
||||
relationships to the given table.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
'subclasses of BaseDatabaseIntrospection may require a '
|
||||
'get_relations() method.'
|
||||
)
|
||||
|
||||
def get_key_columns(self, cursor, table_name):
|
||||
"""
|
||||
Backends can override this to return a list of:
|
||||
|
@ -26,6 +26,11 @@ class SimpleDatabaseIntrospectionTests(SimpleTestCase):
|
||||
with self.assertRaisesMessage(NotImplementedError, msg):
|
||||
self.introspection.get_sequences(None, None)
|
||||
|
||||
def test_get_relations(self):
|
||||
msg = self.may_require_msg % 'get_relations'
|
||||
with self.assertRaisesMessage(NotImplementedError, msg):
|
||||
self.introspection.get_relations(None, None)
|
||||
|
||||
def test_get_key_columns(self):
|
||||
msg = self.may_require_msg % 'get_key_columns'
|
||||
with self.assertRaisesMessage(NotImplementedError, msg):
|
||||
|
Loading…
Reference in New Issue
Block a user