Do not use Literal to count in SQL

The * is not actually a parameter of the aggregate function so it is better to
let python-sql manage it with its default value.
This commit is contained in:
Cédric Krier
2025-12-25 09:47:23 +01:00
parent 4ab7069dab
commit 7fb5a4a3de
19 changed files with 33 additions and 39 deletions
@@ -120,7 +120,7 @@ class Abstract(ModelSQL):
return [
cls._column_id(tables, withs).as_('id'),
opportunity.company.as_('company'),
Count(Literal(1)).as_('number'),
Count().as_('number'),
Sum(opportunity.amount).as_('amount'),
Sum(Case(
(opportunity.state.in_(cls._converted_states()),
+1 -1
View File
@@ -54,7 +54,7 @@ exclude = ['doc']
[tool.hatch.metadata.hooks.tryton]
dependencies = [
'python-dateutil',
'python-sql >= 0.4',
'python-sql >= 1.4',
]
copyright = 'COPYRIGHT'
readme = 'README.rst'