This is my sample query.py
class Query:
XYZ = """ select * from table where date_format(created_at, '%Y-%m-%d') = '{date}' """
In my main.py
current_date = datetime.now().strftime('%Y-%m-%d')
def example():
df = pd.read_sql(Query.XYZ.format(date=current_date), self.db)
print(df)
I'm using SQLAlchemy.
But I'm ending up with this error
ValueError: unsupported format character 'Y' (0x59) at index 309
. I read others solution on this, but didn't understand quite well.