Skip to content

Commit a22c31d

Browse files
committed
feat(tesseract): Athena support
1 parent 0d6492f commit a22c31d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/cubejs-schema-compiler/src/adapter/PrestodbQuery.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,16 @@ export class PrestodbQuery extends BaseQuery {
138138
templates.functions.DATETRUNC = 'DATE_TRUNC({{ args_concat }})';
139139
templates.functions.DATEPART = 'DATE_PART({{ args_concat }})';
140140
delete templates.functions.PERCENTILECONT;
141-
templates.statements.select = 'SELECT {{ select_concat | map(attribute=\'aliased\') | join(\', \') }} \n' +
142-
'FROM (\n {{ from }}\n) AS {{ from_alias }} \n' +
141+
templates.statements.select = '{% if ctes %} WITH \n' +
142+
'{{ ctes | join(\',\n\') }}\n' +
143+
'{% endif %}' +
144+
'SELECT {{ select_concat | map(attribute=\'aliased\') | join(\', \') }} {% if from %}\n' +
145+
'FROM (\n {{ from }}\n) AS {{ from_alias }} {% elif from_prepared %}\n' +
146+
'FROM {{ from_prepared }}' +
147+
'{% endif %}' +
148+
'{% if filter %}\nWHERE {{ filter }}{% endif %}' +
143149
'{% if group_by %} GROUP BY {{ group_by }}{% endif %}' +
150+
'{% if having %}\nHAVING {{ having }}{% endif %}' +
144151
'{% if order_by %} ORDER BY {{ order_by | map(attribute=\'expr\') | join(\', \') }}{% endif %}' +
145152
'{% if offset is not none %}\nOFFSET {{ offset }}{% endif %}' +
146153
'{% if limit is not none %}\nLIMIT {{ limit }}{% endif %}';

0 commit comments

Comments
 (0)