Fixed DatabaseIntrospection.get_relations() docstring.
The foreign keys are "in" the given table, not "to" it.
This commit is contained in:
parent
6bc437c0d8
commit
afea68ca51
|
@ -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 '
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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("""
|
||||
|
|
|
@ -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)}
|
||||
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
Loading…
Reference in New Issue