Commit 517659ad authored by Jacob Schatz's avatar Jacob Schatz

Add year date with extract

parent a7d082d7
......@@ -19,5 +19,5 @@ class Date():
alias = '{}_week'.format((field.get_sql().replace('_', '')))
self.sql = fn.ToChar(DateTrunc('week', field), 'YYYY-MM-DD', alias=alias)
elif timeframe == 'year*':
fields.append('EXTRACT(YEAR FROM {} )::integer AS "{}_year"'\
.format(name, name))
alias = '{}_year'.format((field.get_sql().replace('_', '')))
self.sql = fn.Extract('YEAR', field, alias=alias)
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