The result should be Date object
Since the day cannot be ‘removed’, set it to say, 1st day of the month.
Leaving only Month, Year
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use following constructs to filter the
Datecolumn using eitheryearormonth:And
group_byis also possible:Now I haven’t tested it, but I assume that this might be slow because these queries result in full table scans, therefore I suggest you invest some time and learn how to use composite columns.
Note:
extract()is imported fromsqlalchemy.sql