代码如下:select to_char(date_published, ‘yyyymm’) yo from blog group by yo; 转换成sqlalchemy 语句
可以使用 extract() 代码如下:In[3]: year_field = db.func.extract(‘year’, ArticleModel.date_published) In[4]: month_field = db.func.extract(‘month’, ArticleModel.date_publ