SELECT * FROM dim_date
56 WHERE date_purchase = '"""+date_purchase+"""'
57 AND date_week = '"""+date_week+""""'
58 AND date_month = '"""+date_month+"""'
The variables
date_week
and
date_month
are both
datetime
types, as returned by
datetime.strptime
at lines 43 and 44. You must convert them to string types before you try to concatenate them into another string. Use
datetime.strftime
to get the correct result.