I'm trying to write a table from a .csv file with Hebrew text in it to an sql server database.
the table is valid and pandas reads the data correct (even displays the hebrew properly in pycharm),
but when i try to write it to a table in the database i get question marks ("???") where the Hebrew should be.
this is what i've tried, using pandas and sqlalchemy:
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('mssql+pymssql://server/test?charset=utf8')
connection = engine.connect()
df = pd.read_csv("temp.csv", low_memory=False, encoding="UTF-8")
table_name = "test"
df.to_sql(table_name, connection, index=False, if_exists="append")
this loads the table properly but fails to write the Hebrew,
any suggestions?
texthas been deprecated since 2005, and doesn't support non-ansi characters. The unicode equivalent would bentext, however, that too is deprecated. Change your column's datatype tonvarchar(MAX)in you need to store 4000+ character values with non-ansi characters.