Hi,
I am trying to push some data in sql server database using python 2.7.13 from ubuntu 14.04 LTS. I have one unicode object i.e. u'\U0001f381' in my data. Which is actually (u'\U0001f381') symbol. When I am trying to insert, it is giving me following error:
Python script:
import pymssql
conn = pymssql.connect(host=HOST, user=USER, password=PASSWORD,
database=DATABASE)
cursor = conn.cursor()
field_lst = [u'2017-04-09', u'\U0001f381', 1.0, 0.0, 0.0, 3.0]
placeholder = '%s,' * len(field_lst)
query = 'INSERT INTO my_table VALUES (' + placeholder.strip(',') + ')'
cursor.execute(query, tuple(field_lst))
conn.commit()
Error:
OperationalError(105, "Unclosed quotation mark after the character string ''.DB-Lib error message 20018, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 20018, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\n"),
When I tried to push same data from windows, using pycharm, it is getting inserted into database without any error. Any help would be appreciated. Thanks.