Here is my code
import pandas as pd
from sqlalchemy.engine import URL
from sqlalchemy import create_engine
from sqlalchemy import text
# sqlalchemy==2.0.31
my_df = pd.DataFrame({'col1': [1,2], 'col2': ['foo & bar', 'foo bar']})
engine = create_db_connection() # some code that creates SQLAlchemy engine
my_df.to_sql(name = 'some_table', schema = 'some_schema', if_exists='append', con = engine,index = False)
It runs fine and does not generate any errors, but row with &
does not make to SQL table.
Is there work around?