I am passing some emoticon data from a postgres database object to SQL Server 2016 using pyodbc.
Line 5 has my freeTDS driver I'm using.
def __insert_records(self, rows, target_fields):
try:
mssql_connection = BaseHook.get_connection(self.mssql_conn_id)
connection = pyodbc.connect(DRIVER='FreeTDS',host=mssql_connection.host,DATABASE=mssql_connection.schema,user=mssql_connection.login,password=mssql_connection.password,ClientCharset='utf-8',port=mssql_connection.port,driver='/usr/lib64/libtdsodbc.so')
cursor = connection.cursor()
for i, row in enumerate(rows, 1):
record = []
for cell in row:
record.append(self._serialize_cell(cell))
record_dictionary = self.__get_record_dictionary(record, target_fields)
cursor.execute(self.__generate_insert_sql_statement(record_dictionary))
connection.commit()
cursor.close()
connection.close()
except pyodbc.ProgrammingError as programmingError:
sqlstate = programmingError.args[0]
if sqlstate = '42000':
print(programmingError.args[0])
I need to update the driver (freeTDS) so that I can get around a bug when inserting emojis (related: https://github.com/FreeTDS/freetds/issues/317).
UPDATE: After accessing the CLI in my docker image, I ran tsql -C to get my compile time settings:
Version: freetds v1.1.20
question from:https://stackoverflow.com/questions/66067025/how-do-i-update-freetds-driver-in-rhel-like-docker-image