I have some problems with symbol #
.
Some data in columns contains the symbol #
, for example
'JRE#150'
'July banner #150'
When I am inserting data from file all.csv into SQL Server, records containing this character are not inserted into the table correctly.
What do I mean?!
If I try to insert this value 'JRE#150', only this part 'JRE' is stored, NULL is inserted into other columns.
How the process looks like and what I am doing:
The first independent engine sends me the
all.csv
file from the API to DataFrame.The following line is responsible for importing this data into a file.
.csv is:
df.to_csv(r'C:\\...\all.csv', encoding='utf-8', index=False)
Second independent mechanism is doing this:
df = pd.read_csv(r'C:\\...\all.csv', sep=',', comment='#', encoding='utf-8', low_memory=False) df.to_sql(table_name, engine, if_exists = 'replace', chunksize = None, index=False)
How to insert data into SQL Server with #
, do not replace for another symbol or delete?
What is the problem here and how can I fix it?
I will be grateful for the help.