Commit 5c08772f authored by Vincent Pelletier's avatar Vincent Pelletier

all: Remove table name from selected column aliases.

parent d5066e31
...@@ -98,7 +98,7 @@ select_dict['total_credit'] = None ...@@ -98,7 +98,7 @@ select_dict['total_credit'] = None
# Without this, ColumnMapper would choose to use accounting_transaction.reference, because a lot of # Without this, ColumnMapper would choose to use accounting_transaction.reference, because a lot of
# columns from that table are used. But it does not realise there is no portal_type column *and* # columns from that table are used. But it does not realise there is no portal_type column *and*
# a (portal_type, reference) index exists on catalog. # a (portal_type, reference) index exists on catalog.
select_dict['catalog.reference'] = None select_dict['reference'] = 'catalog.reference'
select_dict['specific_reference'] = None select_dict['specific_reference'] = None
select_dict['project_uid'] = None select_dict['project_uid'] = None
select_dict['payment_uid'] = None select_dict['payment_uid'] = None
......
...@@ -68,8 +68,13 @@ elif at_date is not None: ...@@ -68,8 +68,13 @@ elif at_date is not None:
'query': at_date, 'query': at_date,
} }
select_params = {"select_list" : ['source_section_title', 'destination_section_title', select_params = {
'delivery.start_date']} "select_dict": {
'source_section_title': None,
'destination_section_title': None,
'start_date': 'delivery.start_date',
},
}
# sort_on_list = [ ('delivery.destination_section_uid', 'ASC'), ('delivery.start_date','ASC')] # sort_on_list = [ ('delivery.destination_section_uid', 'ASC'), ('delivery.start_date','ASC')]
......
...@@ -262,9 +262,12 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper, ...@@ -262,9 +262,12 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
supply.validate() supply.validate()
supply_line = self._makeSupplyLine(supply) supply_line = self._makeSupplyLine(supply)
kw = {} kw = {
kw['predicate.uid'] = supply_line.getUid() 'predicate.uid': supply_line.getUid(),
kw['select_list'] = ['predicate.start_date_range_min'] 'select_dict': {
'start_date_range_min': 'predicate.start_date_range_min',
},
}
# check supply line in predicate table # check supply line in predicate table
result = self.catalog_tool(**kw) result = self.catalog_tool(**kw)
......
...@@ -700,18 +700,18 @@ class TestSQLCatalog(ERP5TypeTestCase): ...@@ -700,18 +700,18 @@ class TestSQLCatalog(ERP5TypeTestCase):
# "{column: None}" form, as otherwise it's the user explicitely asking for # "{column: None}" form, as otherwise it's the user explicitely asking for
# such alias (which is not strictly invalid). # such alias (which is not strictly invalid).
sql_expression = self.asSQLExpression({'select_dict': { sql_expression = self.asSQLExpression({'select_dict': {
'foo.default': None, 'foo_default': None,
'foo.keyword': 'foo.keyword', 'foo_keyword': 'foo.keyword',
}}, query_table='foo') }}, query_table='foo')
select_dict = sql_expression.getSelectDict() select_dict = sql_expression.getSelectDict()
self.assertTrue('default' in select_dict, select_dict) self.assertTrue('default' in select_dict, select_dict)
self.assertFalse('foo.default' in select_dict, select_dict) self.assertFalse('foo_default' in select_dict, select_dict)
self.assertTrue('foo.keyword' in select_dict, select_dict) self.assertTrue('foo_keyword' in select_dict, select_dict)
# Variant: same operation, but this time stripping generates an ambiguity. # Variant: same operation, but this time stripping generates an ambiguity.
# That must be detected and cause a mapping exception. # That must be detected and cause a mapping exception.
self.assertRaises(ValueError, self.asSQLExpression, {'select_dict': { self.assertRaises(ValueError, self.asSQLExpression, {'select_dict': {
'foo.ambiguous_mapping': None, 'foo_ambiguous_mapping': None,
'bar.ambiguous_mapping': None, 'bar_ambiguous_mapping': None,
}}, query_table='foo') }}, query_table='foo')
def test_hasColumn(self): def test_hasColumn(self):
......
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