Commit d5a20e69 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Eteri

ZSQLCatalog: Get rid of registerCatalog.

No related key should hardcode "catalog" table name (or any other table
name, for that matter), so just let column mapper work.
parent e3eb40b9
......@@ -170,26 +170,6 @@ class ColumnMap(object):
self.related_group_dict[group] = related_column
return group
def registerCatalog(self):
"""
Register catalog as being in use in query, and aliased with its own
name.
This is used by SearchKey/RelatedKey.py: there is no way to reliably
detect if catalog table is used in a related key, so the catalog table
might be absent from final table mapping.
DO NOT USE IT ANYWHERE ELSE, this will go away...
This must be changed by designing a new related key API, which must:
- state *all* tables they use in their definition
- return Query instances instead of raw SQL code
This will allow chaining related keys and consequently allow
simplifying redundant code.
"""
assert self.catalog_table_name is not None
self.registerTable(self.catalog_table_name)
self.resolveTable(self.catalog_table_name, self.catalog_table_name)
def registerRelatedKeyColumn(self, related_column, position, group):
assert group in self.related_group_dict, (group, self.related_group_dict)
group = self.getRelatedKeyGroup(position, group)
......
......@@ -161,9 +161,6 @@ class RelatedKey(SearchKey):
# Resolve (and register) related key column in related key group with its last table.
column_map.registerColumn(self.real_column, group=group)
column_map.resolveColumn(self.real_column, table_name, group=group)
# Always register catalog, since it is always the "base" table of
# RelatedKeys.
column_map.registerCatalog()
return group
def stitchJoinDefinition(self, table_alias_list, join_query_list, column_map):
......
......@@ -142,14 +142,6 @@ class IColumnMap(Interface):
For example, it's "title" for "source_title" related key.
"""
def registerCatalog():
"""
Register catalog table as being used in default group.
This is for backward compatibility with text-only related keys, since
they often hardcode catalog table name.
"""
def registerRelatedKeyColumn(related_column, position, group):
"""
Register given column as part of already registered virtual column.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment