Fixed DatabaseIntrospection.get_relations() docstring.

The foreign keys are "in" the given table, not "to" it.
This commit is contained in:
Tim Graham 2021-11-10 00:21:36 -05:00 committed by GitHub
parent 6bc437c0d8
commit afea68ca51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

View File

@ -146,9 +146,8 @@ class BaseDatabaseIntrospection:
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.
Return a dictionary of {field_name: (field_name_other_table, other_table)}
representing all foreign keys in the given table.
"""
raise NotImplementedError(
'subclasses of BaseDatabaseIntrospection may require a '

View File

@ -151,7 +151,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
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.
representing all foreign keys in the given table.
"""
constraints = self.get_key_columns(cursor, table_name)
relations = {}

View File

@ -184,7 +184,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
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.
representing all foreign keys in the given table.
"""
table_name = table_name.upper()
cursor.execute("""

View File

@ -119,7 +119,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
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.
representing all foreign keys in the given table.
"""
return {row[0]: (row[2], row[1]) for row in self.get_key_columns(cursor, table_name)}

View File

@ -115,7 +115,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
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.
representing all foreign keys in the given table.
"""
# Dictionary of relations to return
relations = {}