Sergey Nuzhdin

1 minute read

Short sqlalchemy query to get highcharts ready data from database from datetime field.

select count(1), extract(epoch from date_trunc('hour', created_at)) from bid group by extract(epoch from date_trunc('hour', created_at));
            extract('epoch', func.DATE(Bid.created_at)).label('dt'),
        .filter(Bid.ownership == o)
        .filter(Bid.created_at > days_to_count )

Like this post? Want more? Subscribe to get updates delivered straight to your inbox.
comments powered by Disqus